RE: book review: Mastering Algorithms with Perl

Patrick Phalen (
Wed, 24 Nov 1999 11:56:35 -0800

[Hokkun Pang, on Wed, 24 Nov 1999]
:: I brought this book on company's expense so no regret yet.
:: As I was searching for Perl books, the ones for data structure is
:: particularly lacking. Perl's standard data structure (array, hash, etc)
:: have too much overhead and are simply not space efficient.
:: For example, I tried to build a lookup table of 1 million entries. the
:: raw data is about 20Meg but the equivalent Perl hash table uses over
:: a 100 meg of memory. I tried to use Tie variables but there are many
:: restrictions and probably save at most 50%.
:: >From my limited experience, I think Perl is great but then again, I just
:: wish there's a nice C-interpreter with a good set of libraries.

Hmmm ... Let the language wars begin!

This is another Yet Another Area where Python shines (

* Do rapid application development in Python. Due to its simple syntax
you can learn enough Python to do something meaningful over a weekend.

* Use the built-in Python profiler to identify bottlenecks

* Python is designed to be easily extensible in C (or your compiled
language of choice). Write simple C extensions for the data structures
that need speed/efficiency. Your resulting code base will be probably
50% the size of an all-C implementation and will take 30% of the time
to get working.

* Chances are excellent someone has already implemented an applicable
Python C extension for what you're doing (see mxTools, e.g.).

* Alternatively, develop in JPython (an implementation of the
Python interpretor written entirely in Java) and tap into the world of
Java libraries. You don't even need to learn Java to do that.

Since Python is O-O from the ground up, you get code reuseability as a