Monday, May 07, 2012

Bunch of Stuff...

Today feels dastardly different, partly because the temperature is now rising into the 28 degrees Celsius zone. Couple this with the fact that I have not been sleeping enough for the last few days just makes me feel a little woozy in the head. I'm on so many different kinds of self-medication that I'm starting to wonder if I am already down with something.

But anyway, just something cute: ``online'' vi. Not vim, but venerable vi. Pretty cute---I'm tempted to load it on my domain just to make things interesting.

In some other less cutesy news, the multiprocessing module in Python is a quick and dirty way of using the multiple cores that are present in many modern day machines. Dumbly parallelisable algorithms will never be the same again.

Another cool library in Python is the difflib. It contains some rather standard string-edit distance computations, which can save more programmer time when trying to implement those things---I mean seriously, why should we keep reinventing the wheel whenever we program?

Finally, just a tip for using sqlite3 in Python: cache into memory look up structures as much as possible. If things are still slow, consider using PRAGMA cache_size = 10000, where you replace 10000 with some bigger number. That should allow better use of main memory to support those joins and buffers that are oh-so-important for fast execution of queries.

I still haven't figured out if sqlite3 for Python has provisions for prepared statements, and honestly, I don't have the time to figure that out just yet. Maybe next time.

No comments: