make
- first go to
cd prof
- prof test results
./a && gprof a gmon.out > prof.txt
- I dumped some of my result in
prof
. the filename suggests, that:- the first number (before the
x
) isNUM_TESTS
- the second number (after the
x
) isNUM_APPEND
- the first number (before the
Found in src/main.c
:
Vec1
is a non-pointer-persistent vector (memcpy
each entry)Vec2
is a pointer-persistent vector (malloc
each entry, thenmemcpy
)- both hold
Foo
as their item
- I expected
Vec1
to be faster thanVec2
, since calls lessmalloc
/realloc
.
Vec2
was faster in most test cases. I always thought thatmalloc
takes a lot of time, but apparently not (in my test cases. Maybe I just picked wrong test numbers).
- a bit, but when thinking about it, it does make sense.
- in fact, I'm actually relieved, considering the huge benefit of pointer persistence of
Vec2
overVec1
(if I programmed it correctly).
- if the
sizeof(Foo)
were to increase,Vec2
would likely be even faster thanVec1
. This is untested.