* micros = microseconds libc: Test results for test_malloc_255_chunks Test Runs: 10000 micros Allover: 17193 Average micros per call: 1.719300 Test results for test_malloc_256_chunks Test Runs: 10000 micros Allover: 16733 Average micros per call: 1.673300 Test results for test_malloc_4095_chunks Test Runs: 10000 micros Allover: 250090 Average micros per call: 25.009000 Test results for test_malloc_4096_chunks Test Runs: 10000 micros Allover: 245623 Average micros per call: 24.562300 Test results for test_malloc_32000_chunks Test Runs: 100 micros Allover: 2256 Average micros per call: 22.560000 Test results for test_malloc_81920_chunks Test Runs: 100 micros Allover: 1251 Average micros per call: 12.510000 Test results for test_free_chunks Test Runs: 10000 micros Allover: 21040 Average micros per call: 2.104000 Hoard: Test results for test_malloc_255_chunks Test Runs: 10000 micros Allover: 6676 Average micros per call: 0.667600 Test results for test_malloc_256_chunks Test Runs: 10000 micros Allover: 2678 Average micros per call: 0.267800 Test results for test_malloc_4095_chunks Test Runs: 10000 micros Allover: 23456 Average micros per call: 2.345600 Test results for test_malloc_4096_chunks Test Runs: 10000 micros Allover: 3200 Average micros per call: 0.320000 Test results for test_malloc_32k_chunks Test Runs: 100 micros Allover: 1447 Average micros per call: 14.470000 Test results for test_malloc_81920_chunks Test Runs: 100 micros Allover: 40 Average micros per call: 0.400000 Test results for test_free_chunks Test Runs: 10000 micros Allover: 7967 Average micros per call: 0.796700 TCalloc: Test results for test_malloc_255_chunks Test Runs: 10000 micros Allover: 18683 Average micros per call: 1.868300 Test results for test_malloc_256_chunks Test Runs: 10000 micros Allover: 3447 Average micros per call: 0.344700 Test results for test_malloc_4095_chunks Test Runs: 10000 micros Allover: 252899 Average micros per call: 25.289900 Test results for test_malloc_4096_chunks Test Runs: 10000 micros Allover: 19239 Average micros per call: 1.923900 Test results for test_malloc_32k_chunks Test Runs: 100 micros Allover: 202 Average micros per call: 2.020000 Test results for test_malloc_80k_chunks Test Runs: 100 micros Allover: 45 Average micros per call: 0.450000 Test results for test_free_chunks Test Runs: 10000 micros Allover: 12403 Average micros per call: 1.24030 ----------------------- Test Program: #include #include #include #include int counts = 10000; struct timeval start; struct timeval end; long mtime, seconds, useconds; void inline measure(void) { seconds = end.tv_sec - start.tv_sec; useconds = end.tv_usec - start.tv_usec; mtime = seconds * 1000000 + useconds; } void inline show(char * title) { printf("\n Test results for %s\n", title ); printf("Test Runs: %d\n", counts ); printf("micros Allover: %lu\n", mtime ); printf("Average micros per call: %f\n", (float)mtime/(float)counts ); } #define start() gettimeofday(&start, NULL); #define stop(s) gettimeofday(&end, NULL); measure(); show(s); void test_malloc_255_chunks() { int i = 0; char * array[counts]; start(); for( i = 0; i < counts; i++) { array[i]=malloc( 255 ); if(array[i] == NULL) { printf("%s: Malloc error!\n", __FUNCTION__); break; } } stop( __FUNCTION__ ); for( i = 0; i < counts; i++) { if(array[i] != NULL) { free( array[i] ); } } } void test_malloc_256_chunks() { int i = 0; char * array[counts]; start(); for( i = 0; i < counts; i++) { array[i]=malloc( 256 ); if(array[i] == NULL) { printf("%s: Malloc error!\n", __FUNCTION__); break; } } stop( __FUNCTION__ ); for( i = 0; i < counts; i++) { if(array[i] != NULL) { free( array[i] ); } } } void test_malloc_4096_chunks() { int i = 0; char * array[counts]; start(); for( i = 0; i < counts; i++) { array[i]=malloc( 4096 ); if(array[i] == NULL) { printf("%s: Malloc error!\n", __FUNCTION__); break; } } stop( __FUNCTION__ ); for( i = 0; i < counts; i++) { if(array[i] != NULL) { free( array[i] ); } } } void test_malloc_4095_chunks() { int i = 0; char * array[counts]; start(); for( i = 0; i < counts; i++) { array[i]=malloc( 4095 ); if(array[i] == NULL) { printf("%s: Malloc error!\n", __FUNCTION__); break; } } stop( __FUNCTION__ ); for( i = 0; i < counts; i++) { if(array[i] != NULL) { free( array[i] ); } } } void test_malloc_32k_chunks() { int i = 0; char * array[counts]; int oldcounts = counts; counts = 100; start(); for( i = 0; i < counts; i++) { array[i]=malloc( 32002 ); if(array[i] == NULL) { printf("%s: Malloc error!\n", __FUNCTION__); break; } } stop( __FUNCTION__ ); for( i = 0; i < counts; i++) { if(array[i] != NULL) { free( array[i] ); } } counts = oldcounts; } void test_malloc_80k_chunks() { int i = 0; int oldcounts = counts; counts = 100; char * array[counts]; start(); for( i = 0; i < counts; i++) { array[i]=malloc( 4096 ); if(array[i] == NULL) { printf("%s: Malloc error!\n", __FUNCTION__); break; } } stop( __FUNCTION__ ); for( i = 0; i < counts; i++) { if(array[i] != NULL) { free( array[i] ); } } counts = oldcounts; } void test_free_chunks() { int i = 0; char * array[counts]; for( i = 0; i < counts; i++) { array[i]=malloc( 4096 ); if(array[i] == NULL) { printf("%s: Malloc error!\n", __FUNCTION__); break; } } start(); for( i = 0; i < counts; i++) { if(array[i] != NULL) { free( array[i] ); } } stop( __FUNCTION__ ); } int main(int argc, char *argv[] ) { test_malloc_255_chunks(); test_malloc_256_chunks(); test_malloc_4095_chunks(); test_malloc_4096_chunks(); test_malloc_32k_chunks(); test_malloc_80k_chunks(); test_free_chunks(); printf("\n"); return 0; }