python map vs C map.
Ages ago I made some python implementations of map.
Map allows you to call a function on every element of a sequence.
[2,3,4] == map(lambda x:x+1, [1,2,3])
One implementation I made used threads. Which made threaded programing easier for myself.
However the interesting thing was comparing the speed of the builtin map to the map function accelerated by psyco.
It turns out that for a whole bunch of cases the psyco version of map is faster than the CPython version.
Here's some unittests and the map function which show the speed differences.
http://rene.f0o.com/~rene/maps/map_unittests.py
http://rene.f0o.com/~rene/maps/maps.py
It shows how nicely loopy code can be speed up with psyco.
Written by a Melbourne web developer. Available for your projects - python, php, mysql, e commerce, javascript, CMS, css, flash, actionscript, games, postgresql, xml.
Map allows you to call a function on every element of a sequence.
[2,3,4] == map(lambda x:x+1, [1,2,3])
One implementation I made used threads. Which made threaded programing easier for myself.
However the interesting thing was comparing the speed of the builtin map to the map function accelerated by psyco.
It turns out that for a whole bunch of cases the psyco version of map is faster than the CPython version.
Here's some unittests and the map function which show the speed differences.
http://rene.f0o.com/~rene/maps/map_unittests.py
http://rene.f0o.com/~rene/maps/maps.py
It shows how nicely loopy code can be speed up with psyco.
Written by a Melbourne web developer. Available for your projects - python, php, mysql, e commerce, javascript, CMS, css, flash, actionscript, games, postgresql, xml.
Comments