TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Optimizing Python with Cython

5 pointsby erjiangalmost 10 years ago

3 comments

syllogismalmost 10 years ago
If you can live with changing the signature from two tuples to just taking the four floats, you&#x27;ll see a big further improvement --- these are the only lines showing up yellow when running the code through cython -a: <a href="https:&#x2F;&#x2F;rawgit.com&#x2F;syllog1sm&#x2F;a13542690c59d5e60ebf&#x2F;raw&#x2F;4994187cd560aab45dabe772a376171f409bd109&#x2F;gistfile1.html" rel="nofollow">https:&#x2F;&#x2F;rawgit.com&#x2F;syllog1sm&#x2F;a13542690c59d5e60ebf&#x2F;raw&#x2F;499418...</a>
AdmiralAsshatalmost 10 years ago
Looking at this step:<p><i>-from math import sin, cos, acos</i><p><i>+from libc.math cimport sin, cos, acos</i><p>What happens if the C math functions and the Python math functions don&#x27;t take the same arguments&#x2F;kinds of arguments?
kirbyfan64sosalmost 10 years ago
On my system, PyPy is 4x faster than the fastest Cython version given.