Re: slow startup on windows
"John Selverian" <[email protected]> Fri, 25 Oct 2024 11:43:05 -0400
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Organization | JAHM Software |
| Message-ID | <[email protected]> |
The program is a database where everything is stored as strings,
they're all wrapped in classes, so its actually stored as a 4D
array of classes. When it's running it takes 235 MB in memory.
The strings are not displayed in the UI.
I timed this:
FXString* tmp;
long num = 500000;
//long num = 5000000;
for (long i = 0; i < num; i++)
{
tmp = new FXString("test string");
delete tmp;
}
For num = 500,000 it's somewhere around 1 second, for num =
5,000,000 takes about 3 seconds. I also used a longer string
("test string test string test string test string test string
test string test string test string ") and saw no effect. I'm
just timing in the debugger with a stopwatch, nothing fancy so
the times are only approximate but clearly noticeable.
Js
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, October 25, 2024 10:55 AM
To: Enno Rehling <[email protected]>
Cc: [email protected]
Subject: Re: [Foxgui-users] slow startup on windows
On 2024-10-25 09:27, Enno Rehling wrote:
> I second what Roland says, don't load all those strings into
memory,
> or at least not into FXString objects, if you can at all help
it.
Definitely true, but we have sh*tloads of ram these days and I
could load the complete works of william shakespeare in RAM and
not remotely tax the amount of memory of even a raspberry pi.
At an average sentence length of 80 bytes, times 500,000 is only
40 MB.
Size of a single uncompressed 4K image...
It *is* a lot of mallocs() if each of these is an individual
block, each taking perhaps 2000 cycles to allocate, so on a 1GHz
CPU takes around 1 second.
40MB at modern RAM speeds may take around 1ms to write to RAM,
but it will take less because modern CPUs have L3 caches bigger
than 40MB so it'll be all cached.
Basically, there's almost nothing you can do with text that would
even remotely tax a modern machine...
-- JVZ
_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users