General questions from Python user

Welcome. It is good to see new person from the Python sphere, it is still the language that I know the best.

First of all Julia is quite similar to Python on the surface syntax level, but there are noticeable differences. At the same time there are very different when you go deep. My college, who is physicist, starts using Julia thinking that is Python that is fast and as he himself notice, it was wrong attitude. But, when I was talking to him about it last time, he still doesn’t get Julia mindset for programming.

Second, against what Python code you measure you speed? Do you base your program on pure Python or calls to libraries? In Python counting chars in 1 MB string by string_var.counts(“A”) (or something like that) will most probably outperform by far (10, 20, 30, more times?) any thing that you can write by hand using for loops. If you write good Julia code by hand for the same task, it will take below twice time of string_var.counts(“A”). I would suspect very similar time basing on the fact that Python libraries are careful written in C (or similar language), but performers at such peak is not easy things and you can find unexpected regressions in performance.

Writing good code for most part means that you follow already mentioned many times performance tips. Julia documentation is quite dense, but for my taste following this tips can be compared to using Python’s PEPs. I know that “make indent four spaces” is much easier to understand that “avoid containers with abstract type parameters”, but I believe in practices you can be quite well off just memorizing few basic cases. Like “avoid containers with abstract type parameters” → avoid Real, Complex, Abstract Float, etc., use Int32, Int64, Float32 and Float64.

There is one of very big differences between Python and Julia. When using Python you get some rules of the game, you follow them or you need to code in C. In Julia you probably dig deeper, look behind the curtain and under the hood. If you as good as Chris Elrod you can improve your code performance in some amazing ways.

I don’t know if this is an answer to correct question, but I hope that it will help. If you want to hear about it, I will try to help as much as I can. And where I can’t smarter people than me will most definitely could.