Blog de Pierrick Le Gall

Aller au contenu | Aller au menu | Aller à la recherche

lundi 3 juillet 2006

Optimize reading and writting lines with Perl

What's the most optimized Perl code to read lines in a file, extract fields from each line, modify fields and write lines in a new file? I've been working on this question, and here are the result of my test. For my bench, I've used a reference input file made of 1,700,000 lines. Each line containing 6 fields. Input line example 0000482005032030708847018-000000764930-0000079000.

Lire la suite

Perl scripts benchmarking

In Perl Best Practices, I've discovered the use of module Benchmark. This module offers a method to compare the time required to execute a list of subs. In this post gives an example of use of Benchmark and I also propose a script to benchmark scripts, not only subs.

Lire la suite