your script:

01. outf = File.new( "found.log", "w" )
02. r = Regexp.new( "xxx\\xxxxxxxx", Regexp::IGNORECASE )
03. t = Time.new
04. puts t
05. File.new( "WEB.log" ).each_line do
06. 	|line|
07. 	next if line.index( "#" ) == 0
08. 	pom = line.split( "\t" )
09. 	if pom[1] =~ r
10.		outf.write( line + "\n" )
11.	end
12. end
13. te = Time.new
14. puts te
15. print "Time: "
16. puts (te - t).to_s
17. outf.close()

if in line 07 you are checking to see if the first character is a # and
thus ignore the line then do this...

07.	next if line[0]==35 

...where '35' is the ascii value of '#' and on line 10 change to...

10.		outf.puts(line)

..where puts writes a line w/crlf...in your code you add two objects
(strings) together...which may effect speed.  

Also on line 08 an 09 you split a line based on tab which creates an
array.  It may be faster (albiet uglier) to do this:

08    t1 = line.index("\t")+1; pom = line[t1..(line.index("\t", t1)-1)]
09.	if pom =~ r

-rich

> -----Original Message-----
> From: Tomas Brixi [mailto:tomas_brixi / yahoo.com] 
> Sent: Friday, September 20, 2002 12:23 PM
> To: ruby-talk ML
> Subject: Speed up suggestions
> 
> 
> Hello,
> 
> I have written just a simple script to analyze a log file and 
> (just for fun) I have written exactly the same in python to 
> see the difference and ... python is almost twice the faster 
> doing the same job :-| (???) You can see attached files for sources.
> Environment: P4 1.8Ghz, 256MB, WinXP Pro. Python 2.2.1, Ruby 
> 1.7.2-4 - the Pragmatic distribution. The analyzed file is 
> about 420 Mbytes and python does it in about 60 sec and ruby 
> in about 115 sec. Have some suggestion how to speed the ruby code?
> 
> Regards
> 
> Tom
> 
> 
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>