On Wednesday, October 2, 2013 8:26:59 PM UTC+2, Ondřej Čertík wrote:
>
> The problem with Cython is that I am not able to make it as fast as 
> CSymPy in C++, 
> and I tried: 
>
> https://github.com/certik/sympyx/blob/master/sympy_pyx.pyx 
>
> The reason is that to truly nail the speed, one needs to use special 
> dictionary implementation, 
> tweak hashing functions, reference counting, memory allocators etc. 
> C++ allows to play with all that, while 
> having a reasonably high level syntax. In Cython one has to use Python 
> types like hashes/dicts ---- or resort 
> to effectively writing a pure C code --- either way, it becomes 
> overall more complex than just writing 
> things in C++ by hand. So I'll be happy to be proven wrong, but so far 
> C++ is a clear winner in terms of speed. 
>
> Besides speed, I came to appreciate having just one language and write 
> everything in it. Much simpler to maintain 
> and master. With your sympy2cython approach, you need to master 
> Python, SymPy code, the sympy2cython 
> tool, Cython, C and Python C/API intricacies. That's a lot of layers. 
> The reason to do this is speed, otherwise 
> we can just use SymPy --- but to nail speed, you need to master all 
> these layers extremely well, and it might 
> still not be enough --- i.e. I think I know Cython and Python C/API 
> reasonably well, but I don't know how to 
> make the Cython code above as fast as CSymPy. In C++, on the other 
> hand, you can really nail the speed and it is 
> just one language to master and maintain. 
>
> Ondrej
>

OK, maybe for speed purposes C++ handwriting remains the best solution and 
automated translators/code generators are not that good.

What about still trying to force static typing inside selected parts of 
SymPy? I mean, once static typing is enforced, it should become easier to 
translate Python to C++ by hand, because one is not obliged to heavily 
alter the algorithm in case of variables of ambiguous type.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to