A comparison of Cython, Numba, P圜uda, PyOpenCl, NumPy and other frameworks on a simple problem (Mandelbrot set).Useful when one wants to stop working on an iPython session but want to be able to pick it up again from the same state next time. Dill, a package that can serialize/snapshot a python kernel.Scikit-Learn, one of SciKit packages (scipy extensions).Scipy: numpy, scipy, matplotlib, sympy, pandas.Mathematica at least does the multiprocessing data distribution automatically, detecting dependencies and input data that need to be transferred. But it still requires order of magnitudes more effort than threading, killing interactivity (push global objects, imports, functions, all manually across instances). Multiprocessing in Python is great, IPython makes it a breeze to configure a cluster of machines or even many processes on a local machine. But not anything else (all the routines not written in native code, often things such as plots, optimizers, integrators).Įven Julia, which was built specifically for performance, doesn't really do multithreading so far, just "green" threads (one at a time, like python) and multiprocessing. All of them, Python, Matlab and Mathematica, execute only some underlying C code in parallel (e.g. But if you start having to spend a significant amount of time thinking about performance, instead of transforming data, it's a problem.Īlso, it's a mystery to me why most scientific languages are not built for multithreading, at all. It's true that you can do all the optimization staying inside the interactive environment, not needing to change languages. I suspect it's because many packages are pure python. It's similar in this regard to Mathematica, where using functions like Compile often requires planning the code up-front to fit in the restrictions of such optimizers.Įmpirically though it seems that the amount of time I had to spend minding performance patterns in Python is even higher than what I do in Mathematica. Sadly, Python isn't.Įven with simple code, if you're processing a modicum amount of data, you'll need to know its internals, and the variety of options available for optimization. If it didn't matter.Ī language for exploratory programming has to be expressive and high-level, but also fast enough for the abstractions not to fall on their knees. The usual argument is that it doesn't matter at all, because these are scripting languages used to glue very high-performance numerical routines. Python, Matlab, Mathematica, they are all fairly slow languages. We'll see.įor some reason, most of the languages for scientific exploratory programming are really slow. Overall though, things are shifting already, and I really can't see a bright future for Matlab or its clones, as fundamentally Python is a much better language, and for research being open is probably the most important feature. So, is Matlab dead? Not even close, and to be honest, there are many issues Python has to solve. Sadly though for the most Matlab is not that popular because of the unique functionality it provides, but because MathWorks markets well to the academia and it became the language of choice for many researchers and courses.Īlso, researchers don't care about redistributing source nearly as much as they really should, this day and age it's all still about printed publications. Update: nowadays there are a few more libraries using WebGL, which are both fast and allow interactivity in IPython! There are other tools you can use, but most are 2D only, some are very fast and 3D but more cumbersome to use and so on and so forth. Also you can either get it integrated in IPython, but with zero interactivity, or in a separate window, with just very bare-bones support for plot rotation/translation/scale. Matplotlib is really slow, really ugly, and uses a ton of memory. IPython can't display output if assignments are made, and displays only the last evaluated expression. Ok, you got a ton of other libraries too, but matplotlib is popular and the basis of many others too. In Python on the other hand you get IPython and matplotlib. Manipulate is extremely simple, plotting is decently fast and the quality is quite high, there is lots of thought behind how the plots work, picking reasonable defaults, being numerically reliable and so on. Its documentation is great, it comes with a larger wealth of great tools and its visualization options are probably the best bar none.Įxperimentation is an order of magnitude better if you have good visualization and interactivity support, and Mathematica, right now, kills the competition on that front. As a tool for exploratory programming, Mathematica is miles ahead.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |