4 ms·
why would rust have better performance than cython? cython is as fast as C
by rjeli 9y ago
why would rust have better performance than cython? cython is as fast as C
- coldtea 9y agoCython just transpiles to C. It's not "as fast as C", it's as fast as the runtime support structures it uses, and the communication with Python allows.
- rjeli 9y agoyes, exactly as I said.
- ogrisel 9y agoYou can write very efficient Cython code but it's true that in this case, you tend to adopt a lower level code style that is very close to C/C++. Basically, you need to think about the C/C++ code that will be generated by Cython. C/C++ compilers might be able to generate more optimized native code than what rutsc does though. Actually, this is a question: how good is rustc with numerical / math intensive code? For instance, does it implements loop unrolling and SIMD vectorization?
- heavenlyblue 9y agoMost of the time when a developer needs loop unrolling - numpy will work best anyway. Why does everyone always start mentioning this fact when performance is mentioned? For example, in my case I always need high-performance code to work with strings loaded from loads of CSV files. That includes: merging strings, matching them, comparing them. Loop unrolling/SIMD would not really help here, while an ability to write safe, checked code fast - would. On the other hand I do need the pythonic dynamics, so that's what I stick to.