nuclearspaceheater:

regexkind:

nuclearspaceheater:

jadagul:

nuclearspaceheater:

regexkind:

I am so angry

#you asshole there is no reason to have 528Mb of .text

Surely it gets compiled to binary anyway, and this way it’s easier to edit if the primes change.

That is awesome.

And, I mean, what else would you do with the first 50,847,534 primes? It’s not like you want to compute them at runtime.

Another reblog says that this sounds like a job for a lookup file, but maybe this is the lookup file and it ended up being used often enough that it saves a lot of fetch work to just load the entire thing into main memory at the start.

Ok…but something that big is going to end up in swap space probably…if performance is really so vital you should be using a lookup from disk and being careful about reading it

I’ve never personally had to deal with the OS taking things that I thought I’d put down the street and moving them to somewhere among the outer planets in a performance sensitive context, but given the performance demands of modern video games and the size of their art assets, I know it’s possible to stop that sort of thing in C++ somehow.

(But beyond that, why would an OS ever use the swap space when it still has physical RAM, anyway? That would cause noticeable slowdown in almost anything.)

And, of course, if you can spare the memory, then not having to worry about being careful about reading it from disk is a worthy purpose unto itself.

void Sys_PageIn (void *ptr, int size)
{
    byte    *x;
    int     j, m, n;

// touch all the memory to make sure it's there. The 16-page skip is to
// keep Win 95 from thinking we're trying to page ourselves in (we are
// doing that, of course, but there's no reason we shouldn't)
    x = (byte *)ptr;

    for (n=0 ; n<4 ; n++)
    {
        for (m=0 ; m<(size - 16 * 0x1000) ; m += 4)
        {
            sys_checksum += *(int *)&x[m];
            sys_checksum += *(int *)&x[m + 16 * 0x1000];
        }
    }
}

From Quake’s source

https://blogs.msdn.microsoft.com/oldnewthing/20151111-00/?p=91972

The trick that Windows 95 used was to watch your pattern of page faults, and if it saw that you were doing sequential memory access, it started marking the memory 16 pages behind the current access as not recently accessed. In the case of a straight sequential scan, this means that the entire buffer cycles through a 64KB window of memory, regardless of the buffer size. With this trick, a 4MB buffer ends up consuming only 64KB of memory, as opposed to using all the memory in your system.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s