batyann / MC-Heap

Heap memory allocator for microcontrollers, and more (should work everywhere). Ultra fast and efficient, O(1) operations
0 stars 0 forks source link

Long allocation time comparing to malloc #1

Open aroesz98 opened 2 months ago

aroesz98 commented 2 months ago

Hello. I tested that library but when i measured time for allocation with cycle counter i get worse results than using new operator as you can see below: image

Im compiling the code with -O2 switch with NewLibNano std lib runned on OKdo E1 board(2x Cortex M33 ARMv8-m). I have choosen std c11 for C and stdc++17 for C++. Regards

batyann commented 2 months ago

Hi, did you build MC-Heap with MAX_PERF enabled ?

gcc -O2 -Wall -DMAX_PERF -c -o mc_heap.o mc_heap.c

(Note: -O3 will likely give better results.)

aroesz98 commented 1 month ago

I tried with O3 flag for G++ and O3 for GCC. Also i define macro MAX_PERF to get best results but still library is 25% slower than malloc. image image image image

aroesz98 commented 1 month ago

There is a comparison of library performance to lwmem library that im using actually: image