by pg314 · 9y ago · 0 comments
In the telecom domain, I've dealt with data big enough that Python wasn't really feasible. Think 100 of millions of records in CSV format that need to be parsed and processed. Doing that in Python is going to be painful.
I was trying to cut a couple of columns out of a CSV and tried to write it in Java and for some reason either the CSV library was slow or maybe I didn't have the right buffered input but I ended up writing a python script that outperformed my Java code (which reminds me I meant to revisit that).
Anyway here is the python code (it might not be the exact code I used as I didn't update it but whatever):
As a matter of fact, don't know if you've heard, but data processing it kind of like.. Python's thing...
Python itself can be pretty slow. Doing image processing on data stored as list-of-lists-of-integers would be brutally slow.
On the other hand, numpy is an import away, and it can be quite fast, especially if it's been built with an optimized BLAS/ATLAS, etc.
For reference, MATLAB is about 30x slower with no special care. Pure Java on Hotspot was 5x slower except it dies on big data input due to very slow GC and goes to 50x slow.
Source: handled big audio data from hdf5 database, gigabytes sized. C++ equivalent had no vectorization or magic BLAS or anything.
There's a reason almost all deep learning is done in python.
It doesn't have fast libraries for everything. E.g. for the use case I brought up, it doesn't (or at least none that I could find at the time). Not all data are homogenous arrays that fit in numpy.
And are those libraries written in Python? Or in C because Python is too slow?
If you take your reasoning, any language that can bind to C (which is pretty much any language) is as fast as C. That is not very helpful when comparing the speed of languages. A slower language will force you to drop into C sooner than a faster one.
> As a matter of fact, don't know if you've heard, but data processing it kind of like.. Python's thing...
Things like audio and video codecs, or crypto code aren't written in Python.