t2mune / mrtparse

MRT format data parser
Apache License 2.0
136 stars 39 forks source link

adding __slots__ #3

Closed raabf closed 9 years ago

raabf commented 9 years ago

Since you maybe iterate over thousands of messages in a dump it is a good idea to add __slots__ for a better memory consumption and performance.

It seems to save about 5 - 9% time:

/usr/bin/time python3 examples/print_all.py ~/Downloads/rib.20150101.0400.bz2
238.09user 63.81system 5:59.71elapsed 83%CPU (0avgtext+0avgdata 14236maxresident)k
64inputs+0outputs (0major+18652minor)pagefaults 0swaps
/usr/bin/time python3 examples/print_all.py ~/Downloads/rib.20150101.0400.bz2
220.48user 60.77system 5:37.79elapsed 83%CPU (0avgtext+0avgdata 14228maxresident)k
15056inputs+0outputs (16major+18640minor)pagefaults 0swaps
YoshiyukiYamauchi commented 9 years ago

Sorry to keep you waiting... Thank you for your code. It was merged.