Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [SOLUTION] Index and Query (#54)

Reply
Thread Tools

[SOLUTION] Index and Query (#54)

 
 
Daniel Sheppard
Guest
Posts: n/a
 
      11-15-2005
My solution is here:

http://members.iinet.net.au/~soxbox/..._54/indexer.rb

And also a script that benchmarks it against grepping the files manually
(My first attempts ended up being slower... eeep):

http://members.iinet.net.au/~soxbox/.../indexer_bm.rb

I used shakespeare's sonnets from project gutenburg to do the testing.=20

Results:

=20 user system total real
first word 0.157000 0.047000 0.204000 ( 0.219000)
median word 0.109000 0.046000 0.155000 ( 0.156000)
last word 0.141000 0.063000 0.204000 ( 0.203000)
index last word 0.062000 0.000000 0.062000 ( 0.063000)
non-existant 0.063000 0.000000 0.063000 ( 0.062000)
grep first 1.656000 1.453000 3.109000 ( 3.625000)
grep median 1.969000 1.438000 3.407000 ( 3.438000)
grep last 2.343000 1.140000 3.483000 ( 4.125000)

And, if I take out the indexing of the word list file (which wont occur
if you use it from the commandline):

=20 user system total real
first word 0.562000 0.078000 0.640000 ( 0.687000)
median word 0.547000 0.047000 0.594000 ( 0.703000)
last word 0.547000 0.078000 0.625000 ( 1.000000)
index last word 0.469000 0.000000 0.469000 ( 0.500000)
non-existant 0.468000 0.031000 0.499000 ( 0.500000)
grep first 1.875000 1.219000 3.094000 ( 3.219000)
grep median 1.875000 1.250000 3.125000 ( 3.188000)
grep last 1.813000 1.344000 3.157000 ( 3.203000)


################################################## #######################=
############
This email has been scanned by MailMarshal, an email content filter.
################################################## #######################=
############


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" camelean@shaw.ca ASP .Net 3 02-22-2011 07:06 PM
value of performance index and reliability index Matt Schneyer Windows 64bit 10 11-20-2008 01:50 AM
sorting index-15, index-9, index-110 "the human way"? Tomasz Chmielewski Perl Misc 4 03-04-2008 05:01 PM
problem with index.html .(page is automatically gettin redirected to index.html) karthikeyavenkat Java 2 03-17-2005 10:01 PM
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Stefan ASP .Net Datagrid Control 2 07-31-2004 05:52 AM



Advertisments