Re: slow startup on windows

[email protected] Fri, 25 Oct 2024 09:42:59 -0500
Newsgroups gmane.comp.lib.fox-toolkit.user
Message-ID <[email protected]>
On 2024-10-25 09:18, John Selverian wrote:
> On the Mac I’m using Clang, on Linux I’m using g++ (gcc). For
> Linux, I running Ubuntu 20 LTS in a VMWare VM on the Windows PC.
> 
> I tried to use Clang in visual studio. When I just complied my program
> using Clang there was no change. I then tried to rebuild the fox
> library with Clang but got too many errors.
> 
> js
> 
> From: Roland Hughes via Foxgui-users
> <[email protected]>
> Sent: Friday, October 25, 2024 8:05 AM
> To: [email protected]
> Subject: Re: [Foxgui-users] slow startup on windows
> 
> I can provide some unrelated information that might prove
> enlightening.
> 
> Qt implements Copy-on-Write where QStrings are not actually copied
> until something needs to alter the string. According to C++ language
> standards purists this is illegal and a clear violation. Two academics
> enamored with pursuing C++ language standards (and not much else)
> forked Qt 4.8.x to CopperSpice. The first thing they did was get rid
> of Copy-on-Write. Yep yep yep, they can put on white robes, sit cross
> legged with palms skyward chanting ooooohhhhhhmmmmm now.
> 
> The library now also takes 16 minutes to build a QList. [1]
> 
> Yes, I forked their stuff [2] and am busy trying to un-pooch all the
> things they pooched.
> 
> The two behind CopperSpice are all Gaga that Microsoft uses their
> OpenSource project to test language standards compliance. There won't
> be any shortcuts in the Microsoft string libraries. You will have to
> physically copy each and every string each and every time, even for
> the temporaries used as function parameters and intermediary results.
> GCC, being a series of front ends for an intermediary language that is
> compiled by a common back end, is a bit "less pure." It has to handle
> how FORTRAN, COBOL, and dozens of other languages do things and have a
> front end that is "C++ standards compliant." I assume you are using
> GCC on Linux and Mac, correct?
> 
> Do you actually want to know the answer or "just make something that
> works?"
> 
> Know the Answer:
> 
> 1.) port the little QList example program from the link above to Fox.
> It doesn't do much. Build and run on all three platforms making note
> of the elapsed time. 16 minutes is a long time to wait for an
> application to update something on the screen so don't get impatient.
> Have another computer to surf the Web with. <Grin>
> 
> 2.) After proving to yourself performance duth sucketh on Windows,
> visit this link [3] and find a "free enough" C++ compiler for Windows.
> Re-run step 1 on Windows using new compiler.
> 
> 3) If no measurable speed improvement repeat with a couple of other
> "free enough" C+ compilers from the list.

It is known that Microsoft's malloc() is not as fast as Linux glibc
version.  However, please note that whenever you're allocating 500,000
of anything, its going to take some time.

The copy-on-write saves memory. However, to do it safely the COW 
resource
needs to be protected by atomic variables, or worse, mutexes.  What you
win in memory may be lost in speed once there is sharing between 
threads.

The vast number of strings in a GUI are quite short, they're either 
words
or short sentences.  Current day computers have enough RAM to make this 
a non-
problem.

FOX's approach is to copy, not share, strings.  However, we minimize 
copying
and use const reference whereever possible.  The adopt() and swap() APIs 
can
be used to steal or exchange another string buffers w/o alloc/free.
Finally, we can use realloc() to grow string buffer, which, 9/10 times, 
does
not involve copying, with properly designed malloc library.

Finally, if you have 500,000 strings in GUI elements like FXList you may 
want
to see if that's a good idea, it could be over 5000 screens tall, even 
at a
small font pitch, so lot of scrolling.

The real problem is not the quantity of strings but measuring their size 
for
layout.

  -- JVZ





_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users