lilydjwg / swapview-rosetta

Print swap usage per process. Implemented in various programming languages
493 stars 108 forks source link

Add a Cython version #145

Closed felixonmars closed 5 years ago

felixonmars commented 5 years ago

It achieves ~30% speedup than original Python version. Most improvements came from converting startswith to strncmp. There are also small gains (2~5% each) from converting file/string operations.

felixonmars commented 5 years ago

Some benchmarks on my machine:

31% speedup in Python 3 26% speedup in Python 2

5% slower than C version (In comparison, the original Python version is 65% slower than C version)

lilydjwg commented 5 years ago

Merged! Don't forget to update Makefile, README and benchmark.toml next time.