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.

It shows how nicely loopy code can be speed up with psyco.

Melbourne Web Developer Written by a Melbourne web developer. Available for your projects - python, php, mysql, e commerce, javascript, CMS, css, flash, actionscript, games, postgresql, xml.


Popular posts from this blog

Is PostgreSQL good enough?

pygame on pypy usable

Experiments with new low latency PyPy garbage collector in a thread.