Taichi lang: High-performance parallel programming in Python
Out of curiosity, I rewrote their prime counter example to use a sieve instead of being a silly maximally-computation-dense example.<p>To make it work with taichi, I had to change the declaration of the sieve from sieve = [0] * N to sieve = ti.field(ti.i8, shape=N) but the rest of the code remained the same.<p>Ordinary Python:<p>time elapsed: 0.444s<p>Taichi <i>ignoring compile time</i>, I believe:<p>time elapsed: 0.119s<p>A slightly more realistic example than the 10x+ improvement they show on the really toy example with results that aren&#x27;t too bad. I&#x27;d take a 3x improvement for tiny changes. Pretty neat!<p>(I tried some other trivial things like using np.int8 and it was slower. One can obviously make this a ton faster but I was interested in seeing how the toy was if we just made it slightly more memory-bound).<p>A negative was that throwing list comprehensions in made the python version faster - about 0.3 seconds - (and shorter and arguably more &quot;pythonic&quot;) and simultaneously broke the port to taichi.