Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1098245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:33:05+00:00 2026-05-17T00:33:05+00:00

I am generating relatively large files using Perl. The files I am generating are

  • 0

I am generating relatively large files using Perl. The files I am generating are of two kinds:

  1. Table files, i.e. textual files I print line by line (row by row), which contain mainly numbers. A typical line looks like:

    126891 126991 14545 12

  2. Serialized objects I create then store into a file using Storable::nstore. These objects usually contain some large hash with numeric values. The values in the object might have been packed to save on space (and the object unpacks each value before using it).

Currently I’m usually doing the following:

use IO::Compress::Gzip qw(gzip $GzipError);

# create normal, uncompressed file ($out_file)
# ...

# compress file using gzip
my $gz_out_file = "$out_file.gz";
gzip $out_file => $gz_out_file or die "gzip failed: $GzipError";

# delete uncompressed file
unlink($out_file) or die "can't unlink file $out_file: $!";

This is quite inefficient since I first write the large file to disk, then gzip read it again and compresses it. So my questions are as following:

  1. Can I create a compressed file without first writing a file to disk? Is it possible to create a compressed file sequentially, i.e. printing line-by-line like in scenario (1) described earlier?

  2. Does Gzip sounds like an appropriate choice? aRe there any other recommended compressors for the kind of data I have described?

  3. Does it make sense to pack values in an object that will later be stored and compressed anyway?

My considerations are mainly saving on disk space and allowing fast decompression later on.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:33:05+00:00Added an answer on May 17, 2026 at 12:33 am
    1. You can use IO::Zlib or PerlIO::gzip to tie a file handle to compress on the fly.

    2. As for what compressors are appropriate, just try several and see how they do on your data. Also keep an eye on how much CPU/memory they use for compression and decompression.

    3. Again, test to see how much pack helps with your data, and how much it affects your performance. In some cases, it may be helpful. In others, it may not. It really depends on your data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the FPDF library for generating PDF files by PHP. This library
I'm building an application which uses relatively large tables to do its work (
I'm generating json from a Rails app, and am filtering fields using the format.json
I'm about to start developing a large-scale system and I'm struggling with which direction
I am generating tar.gz files with Django and save it to somewhere like /home/foo/foo.tar.gz
Has anyone been able to modify the destination folder of PDB files using CMake
I'd like to start using "SEO Friendly Urls" but the notion of generating and
I'm relatively new to Qt. I am writing an application where I am generating
Our application does some relatively complex stuff, resulting in each request generating somewhere between
I have code that consumes a large number (millions currently, eventually billions) of relatively

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.