Have you ever tried looping 1,000,000,000 numbers?
#1

I was messing around on my script and I wondered how much usage of my PC it would take to save 1 billion accounts into a single file.

So I did it. It actually only used 10k KB. But you couldnt connect to the server


Anyone else tried something similar? Bored..
Reply
#2

I haven't tried saving anything because I don't want to mess up my files but once when I was bored I added a 1-million loop under OnGameModeInit containing 10 loops of the same size, just to see if the server would get the job done. If I remember correctly, the process stopped working. I guess that's a no.
Reply
#3

I got to about 17 million numbers saved into the file, the filesize was nearly 300 mb though

Lines were about 20mill.

I also found out sampgdk c++ is actually slower at looping than pawno.. It also uses more usage.

C++ uses 16-20k KB
PAWN uses 10-12k KB (for me anyways)
Reply
#4

I did loop for about 5 million times...Didnt went good.Well my PC crashed so I lost the data.
Reply
#5

One billion accounts?
Assuming every account just takes one byte, this would result in a one billion byte (=1 Gigabyte) big file, though you probably need much more than a byte. When storing at least the username (~12 bytes) and the password (~12 more bytes), a separator between name and pw (1 byte), and line separators (another byte) the size would sum up to 26 gigabytes.

So 10kb is WAY too small, not matter what youre saving. Probably something in your loop went wrong and crashed or blocked the server, thats why you cant join
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
That depends on what you're doing IN the loop - the loop code itself will be trivial.
I did the exact same in the c++ loop, it may be due to computer CPU usage or something but it definitely was slower at loading each number. Try it, let's see if it's true or not

EDIT:

By 10kb i meant how much was being used (and it was 10K kb :P)

The file was roughly 200 MB big. - And all I did with it was store numbers, not usernames or passwords or any account type info. Just plain out numbers xD
Reply
#7

all I know, if you do something with strings/files in big loops, server just crash.



EDIT, just by any chance someone know why does topics I have read stays bold ?
Reply
#8

I tested and it me created 21.848 accounts (being that had to be 50.000) in 7.531.641 milliseconds. I did it with dini.

Code:



pawn Код:
public OnFilterScriptInit()
{
    new count = GetTickCount();
    for(new i = 0; i < 50000; i++)
    {
        new string[30];
        format(string, sizeof(string), "Accounts/Account_%i.ini", i);
        dini_Create(string);
        dini_IntSet(string, "Password", 6347453);
        dini_Set(string, "Account", string);
        dini_IntSet(string, "Level", 34464345);
    }
    printf("Time: %i.", GetTickCount()-count);
    return 1;
}

Size: 1,34 MB (1.408.916 bytes).
Size on disc: 1,33 GB (1.431.764.992 bytes).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)