zak
22-04-2011, 17:38
i read about this before years, but remembered it when i have compressed the 2MB pi.txt in this thread (http://www.thinbasic.com/community/showthread.php?11120-regular-expressions-usage&p=83098), it is compressed to about half, because pi digits somewhat random and can't be represented in a more concise form.
so i have tried the attached code to make a 51 MB file with just zero's and newlines, when we compress it its new size will be about 55 KB, and you can reduce the compressed file size more by removing the newlines.
do not try to open the resulted text files since it will hang your editor.
if we can describe something big then it can be compressed efficiently
Uses "file","console"
Dim st,s As String
Dim i As Long
PrintL "wait........."
s = "0000000000000000000000000000000000000000000000000000" + Chr$(13) + Chr$(10)
For i=1 To 10000
st=st + s
Next
'FILE_Save(APP_SourcePath +"big.txt",st)
For i=1 To 100
FILE_Append(APP_SourcePath +"bigFile.txt",st)
Next
PrintL "finish"
WaitKey
so i have tried the attached code to make a 51 MB file with just zero's and newlines, when we compress it its new size will be about 55 KB, and you can reduce the compressed file size more by removing the newlines.
do not try to open the resulted text files since it will hang your editor.
if we can describe something big then it can be compressed efficiently
Uses "file","console"
Dim st,s As String
Dim i As Long
PrintL "wait........."
s = "0000000000000000000000000000000000000000000000000000" + Chr$(13) + Chr$(10)
For i=1 To 10000
st=st + s
Next
'FILE_Save(APP_SourcePath +"big.txt",st)
For i=1 To 100
FILE_Append(APP_SourcePath +"bigFile.txt",st)
Next
PrintL "finish"
WaitKey