JCosta <generalco...@gmail.com>: > I did some work in c# and java and I converted some application to > Python; I noticed Python is much slower than the other languages. > > Is this normal ?
Yes. The main reason is the dot notation, which in C through Java is implemented by the compiler as a fixed offset to a memory structure. High-level programming languages such as Python implement it through a hash table lookup. That's the price of keeping everything dynamic: the structural content is free to change any time during the execution of the program. I have heard (but not experienced first-hand) that some ingenious heuristic optimizations have made Common Lisp code come close to C-style performance. Google was gung ho about repeating the feat on Python, but seem to have given up. The second costly specialty of Python is the way objects are instantiated. Each object is given a "personalized" dispatch table. That costs time and memory but is extremely nice for the programmer. In a word, Python is a godsend if its performance is good enough for your needs. For other needs, you have other programming languages, and you buy the performance dearly. Java is a great programming language, as C# must also be. However, for the needs where you need to drop out of Python, one must ask if you weren't better off writing some core parts in C and integrating them with Python. Marko -- https://mail.python.org/mailman/listinfo/python-list