小编dwi*_*s77的帖子

Perl-管道gunzip输出到File :: ReadBackwards

我有一个Perl项目(CGI脚本,在Apache上运行),以前一直使用gunzip和tac(将gunzip压缩到tac,并通过管道将其传输到文件处理)来完成其工作量,即处理大型的纯文本文件,有时每个大小约为10GB或更多。更具体地说,在我的用例中,需要实时解压缩这些文件,并有时需要向后读取(有时这两个条件都是必需的-主要是为了提高速度)。

当我开始这个项目时,我考虑使用,File::ReadBackwards但出于性能原因决定使用tac。在昨晚对一个稍微相关的主题进行了讨论,并提出了一些建议,试图将处理过程完全保留在Perl内之后,我决定再试一下,File::ReadBackwards看看它在这种工作量下的表现如何。

一些初步测试表明,它实际上可能比tac具有可比性,甚至更好。但是,到目前为止,我只能对未压缩的文件进行测试。但是现在它吸引了我的兴趣,因此我想看看是否可以使其与压缩文件一起使用。

Now I'm pretty sure I could probably unzip a file to another file, then read that backwards, but I think that would have terrible performance. Especially because the user has the option to limit results to X number for the exact reason of helping performance so I do not want to have to process/decompress the entirety of a file every single time I pull any lines out of it. Ideally I would like …

perl

2
推荐指数
1
解决办法
87
查看次数

标签 统计

perl ×1