What tool to use?
Rob 'Feztaa' Park
feztaa at shaw.ca
Sun Aug 11 21:45:02 PDT 2002
Alas! Björn Lindberg spake thus:
> Rob 'Feztaa' Park wrote:
> > Alas! Björn Lindberg spake thus:
> > > > Thanks Rob, this works great.
> > No problem.
> > > Correct. You can write both dc and sokoban in sed (it has been done),
> > > together with awk and shell scripting there simply is no need to ever
> > > touch perl. :-)
> > Well, aside from the fact that perl is a million times faster than bash,
> > sure.
> What I meant is that for simpler text file manipulations, you can write
> the entire program in sed or awk, which should be fast enough, esp sed.
> Bash (or Korn Shell for that matter) can be pretty fast if you manage to
> use the built in functionality, and avoid too many external program
Lol, I suppose. I'd still take perl anyday, though.
> Actually, if you check out the first link I posted, it is really
> impressive what the "sedders" manage to get sed to do. One person has
> written an implementation of dc (the reverse Polish notation calculator)
> entirely in sed, complete with arithmetic calculations. It is obvioulsy
> not fast though, but shows that sed is capable of far more than the
> usual s/// substitutions it is normally used for. Oh, and another person
> actually wrote the game "sokoban", also entirely in sed. :-)
Dunno what sokoban is. I've never been a fan of RPN, either ;)
> Awk, then of course, is a complete programming language that can be used
> for most high level programming tasks. (But it's better suited for
> certain tasks, just like any language).
Yup, every language is suited to something. Perl is suited to everything ;)
> Anyways, don't want to start a holy war here. Only pointing out that the
> good old UNIX tools often solves a problem at least as well as Perl
> does. Any tool that solves the problem is good, of course. :-)
Often -- not always. For example, why don't you try to port the attached
program to bash/awk/sed, and we can compare speeds. OK? ;D
> Speaking of speed, have you seen this cool link:
> It is a collection of benchmark tests performed on a large selection of
> languages. Maybe not of much practical importance, but fun nonetheless.
Yes, I have seen it once. Some Python bigot showed it to me. I was happy
to inform him that perl ranked higher than python overall ;)
Dunno how bash got so far up. It's pretty slow. Looks like lots of the
tests bash was in either resulted in "bash was incapable of this" or "we
just couldn't wait that damned long", and they just averaged the ones
that bash *could* do... which totally isn't fair. I wouldn't put much
stock into that site.
Rob 'Feztaa' Park
If you can't understand it, it is intuitively obvious.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 254 bytes
Desc: not available
More information about the blfs-support