Well, we seem to have got rid of the smoked fish (sorry, red herring)
and now have a smoking howitzer......
Paul,
It strikes me that not only is new/delete slow for cygwin331 but that
malloc/delete must also take most of the execution time for the octave
tests. These seem to be totally excluded from the profiling.
I have added the Intel, Visual C and gcc331 times for Windows XP on an
Athlon 1700
Paul T
PS I would have added the exit but I was going to bash ctrl-c is
anything went wrong with the allocation.
Paul Kienzle wrote:
Tests of malloc and new [] for cygwin and mingw 3.2 and 3.3 and linux
gcc 3.3.
Someone please fill in numbers for 'native' windows compilers, such as
visual C and Intel.
=== Times, running under msys on a Windows 2000 PII-300 system
System real user sys
mingw333 17.936 0.030 0.040
cygwin331 72.394 0.020 0.060
Cmingw333 12.277 0.010 0.060
Ccygwin331 24.355 0.030 0.050
System real user sys
mingw323 18.837 0.020 0.040
mingw32 14.160 0.010 0.060
cygwin32 15.933 0.020 0.050
Cmingw32 12.668 0.030 0.040
Ccygwin32 14.410 0.010 0.080
Paul Thomas adds...
=== Elapsed times running under Windows XP on an Athlon 1700
System execution time (octave>
tic;system('./malloctest.exe');toc
intel 2.19
VC 2.17
cygwin331 19.86
Cintel 2.58
CVC 2.37
Ccygwin331 4.34
=== Times, running under bash on a Debian PII-400 system
System real user sys
linux332 4.808 4.800 0.010
Clinux332 3.162 3.160 0.000
=== Versions
mingw32 3.2 (mingw special 20020817-1)
mingw323 3.2.3 (mingw special 20030504-1)
mingw333 3.3.3 (mingw special)
cygwin32 3.2 (20020927 prerelease), linked against stdc++.dll
cygwin331 3.3.1-3 (cygming special)
linux332 3.3.2 20030908 (Debian prerelease)
=== C++ Compiled with g++ -O2. Run under msys.
// Author Paul Thomas
#include <iostream>
using namespace std;
int main()
{
for (int iloop = 0; iloop < 10000000; iloop++)
{
double *myarray;
if ((myarray = new double [1]) == NULL)
cout << "unable to allocate my array at iloop=" << iloop <<
endl;
delete [] myarray;
}
cout << "done looping" << endl;
return 0;
}
=== C Compiled with gcc -O2. Run under msys.
/* modified from C++ by Paul Kienzle */
#include <stdio.h>
int main()
{
int iloop;
for (iloop = 0; iloop < 10000000; iloop++)
{
double *myarray = (double *)malloc(sizeof(double));
if (myarray== NULL) { printf("alloc failed\n"); exit(1); }
else free (myarray);
}
return 0;
}