Archive::Tar::Wrapper vs. Archive::Tar

If you don't know it, Archive::Tar is SLOW; it even says so. Running NYTProf recently on a project revealed that the major part of the program was taking a little more than 27 seconds to run and a little over 24 seconds of this was Archive::Tar reading the archive into memory. Since I did not need the in memory feature, I switched to Archive::Tar::Wrapper. That sub now takes about 2.5 seconds to run and the equivalent portion to Archive::Tar->new($file); is now Archive::Tar::Wrapper->new; $arch->read($file); now takes 631 ms.


If you're just reading Tar archives, check out Archive::Extract::Libarchive . It's supposedly even faster.

Archive::Tar can be a real problem. A while back I patched dzil to use Archive::Tar::Wrapper if it's installed. This seems to make a difference for distros with a lot of files, like Moose.

It'd be nice to have an Archive::Tar::Any that tried the faster ones first, but Archive::Tar does more stuff than the others, from what I've seen. Maybe ::Any would just provide a small subset of the API (extract, create an archive, list its files, that's it).

Leave a comment

About Jesse Shy

user-pic Perl pays for my travel addiction.