Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: How to optimize a regex on a large file read line by line ?

by polettix (Vicar)
on Apr 16, 2016 at 16:57 UTC ( [id://1160657]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to optimize a regex on a large file read line by line ?
in thread How to optimize a regex on a large file read line by line ?

$ time ./script.pl dict.txt Num. Line : 185866729 - Occ : 14900 real 0m39.453s user 0m38.999s sys 0m0.445s $ perl -v This is perl 5, version 16, subversion 2 (v5.16.2) built for darwin-th +read-multi-2level (with 3 registered patches, see perl -V for more detail)
Mac OS X 10.9.5, Intel Core i7 2.4 GHz, 16 GB RAM 1600 MHz DDR3

You can shove some time off getting rid of $counter and using $. instead, a quick test took about 6 seconds less in my configuration.

perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Io ho capito... ma tu che hai detto?

Replies are listed 'Best First'.
Re^5: How to optimize a regex on a large file read line by line ?
by John FENDER (Acolyte) on Apr 16, 2016 at 18:03 UTC
    So maybe an issue related to my Windows/Distro, i will try to search why. Thanks.
      You're welcome. I forgot to add that my hard drive is SSD, although this would NOT account for 11 minutes difference.

      Update added missing negation, thanks ww

      perl -ple'$_=reverse' <<<ti.xittelop@oivalf

      Io ho capito... ma tu che hai detto?

        It make a big difference !!!

        Regarding the other performance i get from other language, i was expected something between 50 and 100 s. My hard drive is a 2.5 laptop disk with 5200 tpm. The ultra optimized grep.exe give me a very good result of 10s, it's the best time i can get.

        But before i was going to check huge volumes, perl was fast. For the 195 mb file, i got 0,61s for grep, 2,25 for java/C#, 3,36 for php, 7 for C++ and 2,47 for perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1160657]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found