Patrick (patrickwonders) wrote,
Patrick
patrickwonders

  • Mood:

Efficiency vs. Sanity

In an earlier post, boba was talking about how nmh tells whether something is a directory or file not by calling stat() on it, but by calling chdir().

I was reading through some documentation on the POSIX bindings in SBCL. I started snickering to myself when I saw readlink(). In SBCL, rather than taking a buffer and returning an error code, they opted to just return the value of the link (or NIL, presumably).

Why did this make me laugh? They chose to streamline this system call. That, in itself, is nothing hilarious. But, I have some extra context. Of course, I can't remember exactly what package it was, but there was some piece of Unix software that I used back in the day that kept its configuration options in a symlink rather than in a configuration file. The rationale in the documentation was that it was more efficient to call readlink() than to call open()-read()-close() and you could even do it if you'd already hit your file-descriptor limit.

So, yep... the dude that wrote whatever package that was would have been thrilled with the sb-posix library for saving him from having to even declare a buffer.

Edit: boba is right... it was wmx.

Tags: lisp
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

  • 1 comment