Re: slow startup on windows

Roland Hughes via Foxgui-users <[email protected]>
Newsgroups gmane.comp.lib.fox-toolkit.user
Message-ID <[email protected]>
Captain Obvious has some stupid questions:

1) Do you have an "automatic update" feature in your program such that 
once per week/month/etc. it reaches out to Internet location looking for 
a new version of itself? This can really hang an application.

2) Does your application in any way use the Internet or network? I'm 
asking because many such applications either have to refresh 
certificates or they keep a DNS cache. (Firefox is notorious for this.) 
The DNS cache has to be flushed and refreshed after a time period and/or 
if the host IP address changes . . . A laptop connecting to a different 
wifi router can cause the IP address to change.

3) Do you run Norton, McAfee, or other third party virus protection. 
That whole "we check every file to keep you safe" promise they make is a 
bit of a Clinton Truth. On a full scan they check them for sure. If you 
download and run an executable for the first time they check them, yes. 
The Clinton Truth comes in the second through N-th time it is run. 
Results of the file scan get cached. File size, timestamps, name, path, 
etc. all gets put into a database with either an expiration date or a 
current timestamp (sometimes both). Most of these programs limit the 
size of this cache otherwise it would consume much of your disk due to 
people downloading, running something once, and deleting. The entries 
could never go away unless they are flushed on full scan or expiration. 
When your executable no longer has an entry in this cache it is a first 
time run. The size of your executable matters little. It's the terabytes 
of DLLs your application utilizes that really kill you here, because 
each of them have to be scanned before you can run.

You can confirm #3 easily. Set up a fresh Windows install, disabling 
Microsoft Malware and antivirus and don't install any other protection. 
Run your executable. First through N-th time should load at roughly the 
same speed.

On 4/26/2023 12:40 AM, Jeroen van der Zijp wrote:
> On Tue, 25 Apr 2023 19:15:21 -0400
> "John Selverian" <[email protected]> wrote:
>
>> I think it's a Windows problem. If I haven't started the program
>> in a while it takes 10 seconds or so before the splash screen
>> shows. If I start it, exit and restart it right away it only
>> takes a second or so before the splash screen shows up. The
>> program is 160 MB, I don't think the size is the problem. My
>> other Fox programs are much smaller and load almost instantly.
>>
>> Probably a dumb question but how do I use FXTRACE()?
>>
>>
>>
>> -----Original Message-----
>> From: [email protected] <[email protected]>
>> Sent: Monday, April 24, 2023 12:11 PM
>> Cc: [email protected]
>> Subject: Re: [Foxgui-users] slow startup on windows
>>
>> On 2023-04-23 16:27, John Selverian wrote:
>>> I don't know if anyone else has this same experience.
>>>
>>>
>>>
>>> On Windows my fox program takes 10 to 15 seconds to show the
>> start
>>> window. On linux & OSX it take less than 1 second.
>> I can't say that I have seen this. Perhaps you can use FXTRACE()
>> to see where it slows down?
> FXTRACE() is a macro, works like printf, but uses double (()) instead:
>
> FXTRACE((100,"the value of five = %d\n",5));
>
> Like FXASSERT, FXTRACE is stripped from the source when compiling
> code for release (i.e. -DNDEBUG=1).
>
> The number "100" here is the trace "level" or "topic".  The higher
> the trace level, the more output you'll see.
>
> Default trace level is 0, so you won't see anything.
>
> When you start an application, you can pass a special flag:
>
>
> 	myapp -tracelevel 100
>
> Print all trace outputs at level 100 or below 0...100.
>
> or:
>
> 	myapp -tracetopics 90:100,105
>
> Print trace commands from topics 90,91...100, and a single topic 105.
>
> The macro is active when FOX [or your own program] is compiled with
> non-release code, as explained before.
>
> Many things that can happen are logged with FXTRACE, from high-level
> things down to lower level things.  The higher the level, the more
> you'll see, until its just too much.
>
> Here's an example, showing high-level events at level 100 and below
> for the somple "hello" program:
>
> ./hello -tracelevel 100
>
> Output:
>
> FXApp::init 1.7.83
> FXSettings::parseFile(/crypt/jeroen/.config/fox.rc,0)
> FXSettings::parseFile(/crypt/jeroen/.config/FoxTest/FoxTest.rc,0)
> FXSettings::parseFile(/crypt/jeroen/.config/FoxTest/Hello.rc,1)
> FXApp::openDisplay(:0.0)
> X Shared Images  = 1
> X Shared Pixmaps = 1
> X Render 0.11 available
> xrrScreenChange: 89
> xfxFixesSelection: 87
> XInputExtension maj:131, evt:66, err:129
> XInput2 ver:2.4
> Device Virtual core pointer id: 2 enabled: 1 attached to: 3 is a master pointer
> Device Virtual core keyboard id: 3 enabled: 1 attached to: 2 is a master keyboard
> Device Virtual core XTEST pointer id: 4 enabled: 1 attached to: 2 is a slave pointer
> Device Virtual core XTEST keyboard id: 5 enabled: 1 attached to: 3 is a slave keyboard
> Device Power Button id: 6 enabled: 1 attached to: 3 is a slave keyboard
> Device Video Bus id: 7 enabled: 1 attached to: 3 is a slave keyboard
> Device Power Button id: 8 enabled: 1 attached to: 3 is a slave keyboard
> Device Sleep Button id: 9 enabled: 1 attached to: 3 is a slave keyboard
> Device Logitech G300s Optical Gaming Mouse id: 10 enabled: 1 attached to: 2 is a slave pointer
> Device Logitech G300s Optical Gaming Mouse Keyboard id: 11 enabled: 1 attached to: 3 is a slave keyboard
> Device HP, Inc HyperX Alloy Origins Core id: 12 enabled: 1 attached to: 3 is a slave keyboard
> Device HP, Inc HyperX Alloy Origins Core Mouse id: 13 enabled: 1 attached to: 2 is a slave pointer
> Device HP, Inc HyperX Alloy Origins Core Keypad id: 14 enabled: 1 attached to: 3 is a slave keyboard
> Device HP, Inc HyperX Alloy Origins Core Consumer Control id: 15 enabled: 1 attached to: 2 is a slave pointer
> Device HP WMI hotkeys id: 16 enabled: 1 attached to: 3 is a slave keyboard
> Device HP, Inc HyperX Alloy Origins Core Consumer Control id: 17 enabled: 1 attached to: 3 is a slave keyboard
> FXApp::create
> wantedName=DejaVu Sans [PfEd] wantedSize=110 wantedWeight=40 wantedSlant=5 wantedSetwidth=0 wantedEncoding=9999
> actualName=DejaVu Sans [PfEd] actualSize=110 actualWeight=40 actualSlant=5 actualSetwidth=100 actualEncoding=9999
> FXRootWindow::create 0x55d1c77cea20
> Start run
> FXMainWindow::onConfigure x=1992 y=1066 w=111 h=27
> FXMainWindow::onConfigure x=1992 y=1066 w=111 h=27
> FXMainWindow::onRestore 0x55d1c7831d60
> FXMainWindow::onConfigure x=1992 y=1066 w=111 h=27
> FXMainWindow::onRestore 0x55d1c7831d60
> FXMainWindow::onRestore 0x55d1c7831d60
> FXMainWindow::onRestore 0x55d1c7831d60
> FXMainWindow::onRestore 0x55d1c7831d60
> SEL_KEYRELEASE code=ff0d state=0000 stickyMods=0000 text=""
> FXMainWindow::onRestore 0x55d1c7831d60
> FXMainWindow::onRestore 0x55d1c7831d60
> FXApp::exit
> FXApp::closeDisplay: closing display.
> FXApp::destroy
> FXRootWindow::destroy 0x55d1c77cea20
> FXSettings::unparseFile(/crypt/jeroen/.config/FoxTest/Hello_212062.rc)
> End run
>
> -----------------------
>
> You can also set the trace level or topics from environment variable:
>
> 	export FOX_TRACE_TOPICS=0:100
>
> is equivalent to:
>
> 	export FOX_TRACE_LEVEL=100
>
> This is recommended, as it'll also dump things happening prior to
> the FXApp::init() being called (C++ ctors may run prior to the
> start of main()).
>
> Hope this helps; you can use FXTRACE in your own code, and its
> painless as its all stripped by pre-processor in release-mode
> builds.
>
>
> 		-- JVZ
>
> P.S.
>
> Older versions of FOX did not have capability to just show individual
> topics, and only supported levels-based method.
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Foxgui-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/foxgui-users

-- 
Roland Hughes, President
Logikal Solutions
(630)-205-1593  (cell)
http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.