What is the best way to gunzip files with Perl?

后端 未结 4 622
面向向阳花
面向向阳花 2021-01-16 07:12

Is there a faster solution than my actual \'zcat\' solution to gunzip files with Perl?

A little benchmark:

#!/usr/bin/perl

use strict;
use warnings;         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-16 07:31

    On typical desktop hardware, the zcat is all but certain to be I/O limited on non-trivial data (your sample files are awfully trivial, they'll be buffered for sure), in which case there isn't going to be any code-level optimization that will work for you. Spawning an external gzip seems perfect to me.

提交回复
热议问题