Why i+=8?

Bob

On 8/5/2015 5:11 PM, Glen Hermannsfeldt (Contractor) wrote:
Instead of a file with 57885161  C'1', I tried a file of 57885161 X'FF'.

BEGIN {
    for(i=0;i<57885161;i+=8) printf "%c",255;
}

08/05/2015  02:02 PM         7,235,646 prime.out
08/05/2015  02:03 PM             7,046 prime.out.gz
08/05/2015  02:04 PM                90 prime.out.gz.gz

and as noted, two passes through gzip.

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Paul Gilmartin
Sent: Wednesday, August 5, 2015 12:57 PM
To: [email protected]
Subject: Re: useless but amusing: largest known prime

On 2015-08-05 12:50, Gibney, David Allen,Jr wrote:
Taking 7M to store. I wonder how well that will compress :)

I decided to try something practical:

506 $
506 $ time awk 'BEGIN { for ( I = 0; I<57885161; I++ ) printf( 1 )
         print }' | gzip | wc
       1       5   56203

real    0m18.422s
user    0m11.265s
sys     0m6.188s
507 $
507 $ uname -a
Linux Gil-CrunchBang-Lenovo 3.2.0-4-686-pae #1 SMP Debian 3.2.68-1+deb7u2 i686 
GNU/Linux

Dismaying; barely a factor of 1000.  And dumping shows obvious redundancy.
So I compressed it again (which rarely helps) and gained another factor of 200:

       0       8     255

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to