Current results of "dictionary word count" programs...

Matthew Walker mwalker at forevergreen.org
Mon Mar 13 15:00:50 MST 2006


Realized I didn't write this to accept commandline input, so I tweaked it.

Usage:
	./wc.php <file to count>

Assumes:
	/usr/bin/php
	/usr/share/dict/words

On Monday 13 March 2006 14:46, Matthew Walker wrote:
> Here's a pretty quick PHP version. Took me about 5 minutes to throw
> together.
>
> On Monday 13 March 2006 12:33, Bryan Sant wrote:
> > Here are the current results for the "count the dictionary words in a
> > file" programs submitted thus far.
> >
> > All programs were executed on my Ubuntu 5.10 system:
> > IBM Thinkpad T43 - Intel Pentium M 2.26GHz
> >
> > I used /usr/share/dict/words as the dictionary (which contains 96274
> > words). I used an uncompressed copy of /usr/share/doc/bash/changelog.gz
> > as the input file (which contains 42362 words).
> >
> > C++ (GCC 4.0.2 with -O2)
> > ------
> > LOC:  34
> > Best Time:  0.804
> > Worst Time:  2.087
> > Avg. Time:  1.44
> >
> > Java (Sun 1.5)
> > ------
> > LOC:  35
> > Best Time:  1.247
> > Worst Time:  1.622
> > Avg. Time:  1.54
> >
> > Ruby 1.8.3 ("scripted" version)
> > ------
> > LOC:  18
> > Best Time: 1.966
> > Worst Time:  3.297
> > Avg. Time:  2.35
> >
> > Python 2.4.2 (bad algorithm?)
> > ------
> > LOC: 6
> > Best Time: 31.724
> > Worst Time: 32.417
> > Avg. Time:  31.98
> >
> > I'm still trying to get the lisp version to work (I have a load
> > error).  I'd like a good PHP and Perl version as well as a better
> > Python version (the python version isn't producing acurate output and
> > is WAY slower than is reasonable).
> >
> > -Bryan
> >
> > /*
> > PLUG: http://plug.org, #utah on irc.freenode.net
> > Unsubscribe: http://plug.org/mailman/options/plug
> > Don't fear the penguin.
> > */

-- 
Matthew Walker
ForeverGreen
matt at thebraingarden.com
Work: (801) 655-5500
Home: (801) 491-2079

Random Quote:
A great country is like low land.
It is the meeting ground of the universe,
The mother of the universe.

The female overcomes the male with stillness,
Lying low in stillness.

Therefore if a great country gives way to a smaller country,
It will conquer the smaller country.
And if a small country submits to a great country,
It can conquer the great country.
Therefore those who would conquer must yield,
And those who conquer do so because they yield.

A great nation needs more people;
A small country needs to serve.
Each gets what it wants.
It is fitting for a great nation to yield.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20060313/9adacce5/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wc.php
Type: application/x-php
Size: 579 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20060313/9adacce5/attachment-0001.bin 


More information about the PLUG mailing list