the large file challenge

Sadhunathan Nadesan sadhu at castandcrew.com
Sat Nov 9 20:24:01 EST 2002


Wow,

Just logged on to work and saw all the great responses.  Thanks all,
what fun.

Anyway I will respond to each later and try your code too.  I have
to run right now, appointment.

I did however have some code from Andu via Swami that I modifed 
somewhat and got enormous speed improvement.

Here's the latest run (ran this several times so file
would be in cache equally for all programs).

.....
bash
Sat Nov  9 16:48:12 PST 2002
17333
Sat Nov  9 16:50:05 PST 2002

pascal
Sat Nov  9 16:50:05 PST 2002
17333
Sat Nov  9 16:52:09 PST 2002

metacard
Sat Nov  9 16:52:09 PST 2002
17338
Sat Nov  9 16:54:28 PST 2002
.....



So that is 1:53 for bash, 2:04 for pascal, and 2:19 for MC. darn good!

Here's the code, gott go...


#!/usr/local/bin/mc
on startup
     put 0 into the_counter
     put 1 into the_offset
     put 333491183 into file_size
     put   30000 into the_increment
     put "/gig/tmp/log/access_log" into the_file

     open file the_file for read

     repeat until (the_offset >= file_size)
	  read from file the_file at the_offset for the_increment
	  put it into the_text
	  repeat for each line this_line in the_text
	       get offset("mystic_mouse", this_line)
	       if (it is not 0) then add 1 to the_counter
	  end repeat
	  add the_increment to the_offset
     end repeat

     put the_counter
end startup




More information about the metacard mailing list