Water-dwelling mammals, sticky tape, idiots, and fickle metals


I consider the errant arrival of individuals to this blog by way of Google searches like “pygtk error” and “vimperator slow” to be roughly analogous to dolphins being ensnared in a trawler’s net, to be canned along with tuna for the consumption of hungry and dolphin-loving children.

Ok, poor analogy. But it sounded funny in my head.

I’ve been dabbling more in Ruby, probably over the limit of what is considered healthy. More specifically, I rewrote fui in Ruby, just to see how Ruby solves its problems in a Rubyish way. I have named it sel, as in select, with the ect gone on a walk. I think I finally understand how option parsing works, though the structure of it that exists in my head is a very rickety wooden one, prone to disintegration by the winds of confusion.

When I first became interested in programming, I, like a lot of other people, was far too enamoured with the speed of languages. How fast this is one? How slow is that one? The fast ones are unquestionably better ones, thought I, the highly prejudiced, completely blank-slate I. Fast is almost a synonym for good in this blighted modern society–all lanes of a road are the right lane these days. Given my laptop is not a very powerful or new one (1.73ghz 256mb ram), I suppose I can be forgiven for my initial obsession over speed. You guys with duo core systems and +2gb ram–I cast an evil eye upon your hapless selves.

But since then, my thinking has changed. After throwing myself at C and Haskell and Python and Ruby, I can say that I prefer higher-level interpreted languages–great for complete newbies like me, just load up the interpreter and have fun. A program/script written in Python or Ruby is only initially slow, when it has to load the interpreter into memory–after that the speed is actually quite acceptable to me.

My implementation of sel, the Ruby equivalent to fui, is a bit slower than its Python cousin. I say this very guardedly because the scripts are so trivial that benchmarking them is, well, trivial. I found a speed difference of around 0.1-0.2 seconds with selecting, which isn’t a huge performance hit as I had been dreading with Ruby before stepping into it.

Apart from that I also have to wean myself off the tendency to make my code as terse as possible. Sel is currently at around 180 lines of code, and fui is nearly at 300. Sel would be at 200 if I weren’t so zealous. If I go any further I risk obfuscating the code (what fun words one learns when one soaks oneself in a different atmosphere online; obfuscation, twitter, api, unit tests, profiling galore!), and I do not intend on reinventing a modern dialect of hieroglyphics.

Another issue worthy of comment: github. I have split myself between mercurial and git, bitbucket and github. In which lot shall I plant my lowly allegiances? Github is absolutely crawling with Ruby. Bitbucket is less popular, it seems. In any case, I don’t think I will be able to remove either of their respective version control systems from my laptop any time soon. Decisions, decisions….

Oh, by the way, for anyone who is starting to learn Ruby, a good thing to install is fastri. The default ri searches through Ruby documentation very, very slowly and very, very painfully compared to fastri. It’s definitely worth the disk space.

Today’s blog post has been brought to you by a boring/bored person with nothing better to do… see you next time!


%d bloggers like this: