Perl Monk, Perl Meditation | |
PerlMonks |
Re^3: Inline::C's AoA is much bigger than Perl'sby ikegami (Patriarch) |
on Mar 17, 2009 at 01:26 UTC ( [id://751077]=note: print w/replies, xml ) | Need Help?? |
The remaining difference in memory is due to the Perl version knowing exactly how big the array will be from the start (because the whole list is assigned in one go):
The C version causes the arrays to grow and leaves space for growth:
By pre-extending the arrays,
both the Perl and the C data structures are identical.
and the process that calls the C version uses less memory (perhaps from reduced stack usage?)
The times are comparable, but note this it a busy machine.
In Section
Seekers of Perl Wisdom
|
|