Jump to content

Weird compression idea... Probably dumb but...

Poet129
5 minutes ago, mariushm said:

just post the source code.

I can write a program that writes 4 TB in a few lines of code, doesn't mean it produces anything useful.


 




$h = fopen('file.txt','w');

$buffer = str_pad(' ',1048576,' ');

for ($i=0;$i<4000;$i++) { fwrite($h,$buffer); }

fclose($h);

 

from random import seed
from random import randint
z = 0
srtstrlen = 10000000000000 # or 2500000000 for 1 GB
seed(int(z))
srtstr = ""
for num in range(int(srtstrlen)):
    value = randint(0, 9)
    srtstr = str(srtstr + str(value))
Filename = "4TB.txt"
OpenFile = open(Filename, "wb")
Data = int(srtstr).to_bytes((int(srtstr).bit_length() + 7) // 8, byteorder="big")
OpenFile.write(Data)
OpenFile.close()

Also this is not zero data as it has been calculated by the compressor.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Poet129 said:

from random import seed
from random import randint
z = 0
srtstrlen = 10000000000000 # or 2500000000 for 1 GB
seed(int(z))
srtstr = ""
for num in range(int(srtstrlen)):
    value = randint(0, 9)
    srtstr = str(srtstr + str(value))
Filename = "4TB.txt"
OpenFile = open(Filename, "wb")
Data = int(srtstr).to_bytes((int(srtstr).bit_length() + 7) // 8, byteorder="big")
OpenFile.write(Data)
OpenFile.close()

Also this is not zero data as it has been calculated by the compressor.

This is a lot faster with 40KB parts, Also new progress percentage:

from random import seed
from random import randint
z = 0
srtstrlen = 100000
seed(int(z))
srtstr = ""
srtstrint = 0
for num in range(int(srtstrlen)):
    value = randint(0, 9)
    srtstr = str(srtstr + str(value))
    srtstrint += 1
    print(str(int(srtstrint / srtstrlen * 100)) + "% Complete.", end="\r")
Filename = "40KB.txt"
OpenFile = open(Filename, "wb")
Data = int(srtstr).to_bytes((int(srtstr).bit_length() + 7) // 8, byteorder="big")
OpenFile.write(Data)
OpenFile.close()

 

Link to comment
Share on other sites

Link to post
Share on other sites

So you're just writing random data to a file.  What's the point of this?   It's not a compressor, it's not a decompressor, it's nothing useful. 

If you're aiming for highest speed, aim for multiples of 512 bytes and 4096 bytes ... common sector sizes, so go for 32768 bytes or 65536 bytes or 1024 x 512 bytes = 524288 bytes.

 

Link to comment
Share on other sites

Link to post
Share on other sites

14 minutes ago, mariushm said:

So you're just writing random data to a file.  What's the point of this?   It's not a compressor, it's not a decompressor, it's nothing useful. 

If you're aiming for highest speed, aim for multiples of 512 bytes and 4096 bytes ... common sector sizes, so go for 32768 bytes or 65536 bytes or 1024 x 512 bytes = 524288 bytes.

 

It was random in this case to show that it didn't create zero data.

Edit: randint when given a specific seed will always make the same number, similar to a minecraft seed always making the same world. Then I use the original string length of the bytes converted to numbers to know where to stop creating "Random" Data.

Edited by Poet129
Link to comment
Share on other sites

Link to post
Share on other sites

-Cleaned-

Please don't attach executables. Post the code if you would like to, but keep away from the exe's

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 3600 || GPU: RTX 3070|| Memory: 32GB @ 3200 || Cooler: Scythe Big Shuriken || PSU: 650W EVGA GM || Case: NR200P

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×