https://github.com/vanng822/pyperf
for some simple performance test on python
https://github.com/vanng822/pyperf
Last synced: 2 months ago
JSON representation
for some simple performance test on python
- Host: GitHub
- URL: https://github.com/vanng822/pyperf
- Owner: vanng822
- Created: 2013-08-03T11:24:39.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-08-11T09:03:13.000Z (almost 13 years ago)
- Last Synced: 2025-03-11T16:49:43.422Z (over 1 year ago)
- Language: C
- Size: 285 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
pyperf
======
for some simple performance test on python
# How to
# assume python 2.7
> virtualenv -p python python2.7
> source python2.7/bin/activate
> pip install cython
# for compiling latest version of cymandelbrot
> cython mandelbrot/cymandelbrot.pyx
# run the test code
> python setup.py test -s tests.test_mandelbrot_compare.MandelbrotTest
# Compiling using swig on Mac but inchecked binary may work if you don't have swig
> cd mandelbrot
> swig -python swigmandelbrot.i
> gcc -c mandelbrot.c swigmandelbrot_wrap.c -I../python2.7/include/python2.7/
> gcc -bundle `python-config --ldflags` mandelbrot.o swigmandelbrot_wrap.o -o _swigmandelbrot.so
# Result
## Mandelbrot
C-module
4 function calls in 0.015 seconds
Cython
4 function calls in 0.018 seconds
Swig on same c code as C-module
4 function calls in 0.027 seconds
Python
12329 function calls in 2.347 seconds
## Sieve of Eratosthenes
Python
7 function calls in 9.984 seconds
Cython
4 function calls in 0.180 seconds
C-module
4 function calls in 0.173 seconds
Swig
4 function calls in 0.269 seconds