Bash inefficiency

I need to create 2 million entries in a mysql table for some testing. Figured I'd use a bash script. The script took 10 minutes to write, but would took 1min39s to create the SQL for just 5000 rows. Extended inserts made no difference. I spotted that I'd used md5sum to create dummy data. Removing that speeded it up to 49s. Removing some debugging echo statements got me to 39s.

Finally, I decided to rewrite it in Python. 0.2s!! Now there's optimisation for you, and a lesson in when not to use bash.

Interestingly, I rewrote it in Perl (folks here know Perl better) , which took 0.34s, so on this occasion, Python wins!