Jump to content

Script becomes way slower after a msgbox - (Moved)


Recommended Posts

Hi everyone.

I noticed something very weird on my windows 10 computer.
When the script isn't "graphic" (no msgbox, inputbox, gui etc), the script is relatively fast.
Whenever a script becomes "graphic" (a msgbox was launched) its execution is then 6 times slower.
Here are the results of the execution of this script :

$x=0
$start=TimerInit()
for $i=1 to 500000
    $x+=1
Next
MsgBox(0,"",TimerDiff($start)) ;160ms => becoming slower now because of the msgbox

$start=TimerInit()
$x=0
for $i=1 to 500000
    $x+=1
Next
MsgBox(0,"",TimerDiff($start)) ;1300ms

I tried on my windows 7 computer and the bug isn't there.
I tried everything and it really comes to this => whenever something graphic has been prompted, even if it's over, the script is way slower then.

Can someone try to reproduce this? And how do I report a bug?

Link to comment
Share on other sites

First, why did you post this in the "AutoIt Projects and Collaboration" forum?  This has nothing to do with a project or a collaboration.

 

I do not get any large differences between the 2 loops when I execute your code:

$x=0
$start=TimerInit()
for $i=1 to 500000
    $x+=1
Next
ConsoleWrite("Loop 1 Elapsed time: " & TimerDiff($start) & @CRLF)

$x=0
$start=TimerInit()
for $i=1 to 500000
    $x+=1
Next
ConsoleWrite("Loop 2 Elapsed time: " & TimerDiff($start) & @CRLF)

Output:

Loop 1 Elapsed time: 64.3125556633415
Loop 2 Elapsed time: 64.5393475676982

 

Link to comment
Share on other sites

Win10 Enterprise shows similar results after the MsgBox. Interestingly, subsequent loops have the same speed as the second loop, never reverting to the original speed.

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

LOL, yes I just noticed that.  :oops:

I see the same discrepancies, as the original post, when I execute the script with MsgBox,

Edited by TheXman
Link to comment
Share on other sites

Link to comment
Share on other sites

No that makes sense (I think), everything gets garbage collected after the executed line exits and it's all in another process so it doesn't matter to the current process

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Link to comment
Share on other sites

Only Devs can tell but isn't the issue related to the various hooks or message interceptions that AutoIt core has to setup before any GUI operation, which aren't needed until the first GUI is invoked.

But why is Win 10 different from Win 7 in this aspect is a mystery to me.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Developers
14 minutes ago, jchd said:

Only Devs can tell but isn't the issue related to the various hooks or message interceptions that AutoIt core has to setup before any GUI operation

I doubt this, without having looked at it in detail in the source, but AutoIt3 always has a background GUI running to be able to work with the Windows Messages.
A call to MSGBOX is really a standard DLL call to MessageBoxW. ....  maybe one could try using that to see if that is similar?

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thank you all for your answers, and sorry for posting on the wrong forum, that's my first post.

Do I need to do anything for the devs to know about it? Or you guys handle that?

Btw my guess was : whenever the script display something (even once) it suddenly gets different from a "classical script" (as you said different hooks etc), maybe windows 7 manages to get back to a classic execution, and windows 10 doesn't.

Knowing that, executing the msgbox through another script solves it, thanks for your trick !

I hope it's gonna be solved soon (or a work around) because it means you can never have both a quick script and displaying windows on windows 10..

Link to comment
Share on other sites

Link to comment
Share on other sites

Ouch!

It's surprising that others applications don't seem to exhibit that slow behavior under W10, at least I can't find any significantly slower app under W10 than W7 and on the contrary, I feel my rig more responsive (I upgraded just recently).

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

SplashTextOn() doesn't slow things...

MsgBox() slows by factor 6 for me!  That's something!

EDIT: MsgBox() still slows thing by 6 in compiled CUI scripts...

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Link to comment
Share on other sites

Here's a function to avoid the issue (also allows a non-blocking msgbox).
It's an ugly version but I'm sure you guys will improve it :)

Func MsgBox_ext($type = 0, $title = "", $txt = "", $block = 1)
    $txt = StringRegExpReplace($txt, "('|" & '")', "$1$1")
    $type = StringRegExpReplace($type, "('|" & '")', "$1$1")
    $title = StringRegExpReplace($title, "('|" & '")', "$1$1")
    If $block <> 1 Then
        Return Run(@AutoItExe & ' /AutoIt3ExecuteLine "' & "MsgBox('" & $type & "','" & $title & "','" & $txt & "')" & '"')
    Else
        Return RunWait(@AutoItExe & ' /AutoIt3ExecuteLine "' & "Exit(MsgBox('" & $type & "','" & $title & "','" & $txt & "'))" & '"')
    EndIf
EndFunc   ;==>MsgBox_ext

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...