Weird languages (was Re: [CLUE-Tech] Font List and Removal?)

Matt Gushee mgushee at havenrock.com
Wed Apr 7 22:22:57 MDT 2004


On Wed, Apr 07, 2004 at 12:26:32PM -0600, Keith Hellman wrote:
> Oh My God.  Matt's Crossed Over to the Functional Dark Side!

Dark Side, huh?

So I have this 27-line program that took ~10 minutes to write, and I
compile it to native code:

  $ time ocamlfind ocamlopt -package gd -linkpkg -o fontpix fontpix.ml 

  real    0m3.495s
  user    0m2.030s
  sys     0m0.250s

Then I run it:

  $ time ./fontpix /usr/local/share/fonts/ttf /var/tmp
  
  real    0m6.305s
  user    0m3.890s
  sys     0m0.790s

Well, let's see what I got:

  $ ls /var/tmp/*ttf.png |wc
      125     125    3229

Looks pretty sunny to me! Now, to be honest, this isn't a totally
authentic example because it's based on a C library--I imagine you'd get
similar figures if you wrote the program in Python, using the PIL--but
according to my experience and every benchmark I've seen, you usually
get equally great performance with pure OCaml code.

Of course, OCaml has that horrible stigma of being "non-mainstream,"
whatever the fsck that means. But I figured, well, Python wasn't all
that great for earning a living (and I'd gotten really bored with it),
and in the Great Church of Java I was little more than a second-string
choirboy, so I set off to find superior tools and see what I could do
with them. I think I'm starting to get somewhere. It's no way to get
rich, but at least I'll have a sense of accomplishment.

> :^)

:-))

> Seriously, I've been trying to do some reading on functional languages,

Good for you! Hmm ... are you trying to learn Haskell, by any chance? If
so ... wow! Haskell's great for exploring FP theory, but if you can
learn to write real programs in it, I will bow down before you in awe.
Then again, don't be afraid to give up and try an easier language (like
almost any other language).

> but your obviously farther along than I. 

Well, start hacking, dude!

> Hope your well.

Eh. Getting by. How about you?

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee at havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)



More information about the clue-tech mailing list