5 ms·
Now if I can just use SIMD directly from Python without calling out to another language.
by azhenley 1y ago
Now if I can just use SIMD directly from Python without calling out to another language.
- adgjlsfhk1 1y agowhy would you want to? if you are performance bound with Python code, you can pick up a 20-50x performance improvement by switching language.
- jgalt212 1y agoRight, but if there's only a small portion of my code that does string search and it's a hot path, it would still be much much much more convenient to access SIMD-based string search code direct from Python rather than writing the code (LLM or not) in another language and then construct bindings (LLM or not).
- kristianp 1y agoYou can use cython and call C SIMD code from it.
- adgjlsfhk1 1y ago2 problems. 1. Python's data types are all bad for performance 2. once you optimize once part, a new part will be the bottleneck
- ashvardanian 1y agoHi Austin! Was just checking your blog and the vowels detection post (< https://austinhenley.com/blog/vowels.html https://austinhenley.com/blog/vowels.html>). What exactly do you mean by “use SIMD directly without calling out to another language”? In some way Assembly will probably anyways be another language… but that’s a technicality. I guess the spectrum of SIMD-related work in relation to Python is quite broad. There are projects like PeachPy, to help one write x86 Asm in Python, new Python’esque languages like Mojo, or SIMD libraries with thin CPython bindings. Do you mean one of those? PS: I’m in the last camp. And in case you are focused on ASCII, for vowel search, have you tried StringZilla’s `find_first_of` (< https://github.com/ashvardanian/StringZilla/blob/960967d78c7facf6de2de9d5eecc0ac7f5ce19b8/scripts/bench_search.py#L78 https://github.com/ashvardanian/StringZilla/blob/960967d78c7...>)? I think it should perform well ;)
- rainmaking 1y agoTry Nim. It's pretty easy to get the hang of it for simple things, and you can make a python module too.