Jump to content

Script becomes way slower after a msgbox - (Moved)


Recommended Posts

#RequireAdmin and running under x64 reduces this effect.

Win 10 (17763) x64.

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I hate this :censored: Microsoft numbering scheme 🤬

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

14 minutes ago, MrCreatoR said:

#RequireAdmin and running under x64 reduces this effect.

your version is "Version 1809 (October 2018 Update)" and me, testing 1903, shows that you say but the difference is on #RequireAdmin only.

..is on x86 ( slower ) , vs x64 ( faster )

For $n = 0 To 1
    AutoItSetOption('GUIOnEventMode', $n)
    $x = 0
    $start = TimerInit()
    For $i = 1 To 500000
        $x += 1
    Next
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : TimerDiff($start) = ' & TimerDiff($start) & @TAB & ' GUIOnEventMode = ' & $n & @CRLF) ;### Debug Console
    ; Show the AutoIt3 hidden window
    WinSetState(AutoItWinGetTitle(), "", @SW_SHOW)
    $start = TimerInit()
    $x = 0
    For $i = 1 To 500000
        $x += 1
    Next
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : TimerDiff($start) = ' & TimerDiff($start) & @TAB & ' GUIOnEventMode = ' & $n & @CRLF) ;### Debug Console
Next
;~ -------------------------------------------- x86
;~ @@ Debug(21) : TimerDiff($start) = 62.6216    GUIOnEventMode = 0
;~ @@ Debug(29) : TimerDiff($start) = 327.3202   GUIOnEventMode = 0
;~ @@ Debug(21) : TimerDiff($start) = 440.6563   GUIOnEventMode = 1
;~ @@ Debug(29) : TimerDiff($start) = 440.1473   GUIOnEventMode = 1
;~ -------------------------------------------- x64
;~ @@ Debug(29) : TimerDiff($start) = 70.367     GUIOnEventMode = 0
;~ @@ Debug(37) : TimerDiff($start) = 200.1072   GUIOnEventMode = 0
;~ @@ Debug(29) : TimerDiff($start) = 333.702    GUIOnEventMode = 1
;~ @@ Debug(37) : TimerDiff($start) = 332.493    GUIOnEventMode = 1
;~ --------------------------------------------


 

Edited by argumentum
mistake

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Here W10 Pro x64 v1909 OSversion 18363.752

Slowdown *6 on both x86 and x64 runs (compiled or not).

Fresh install + update (sorry, it's French):

Update history.jpg

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

That avalanche of diverging version formats, names, limitations, ... is a complete mess. $MS is known for messing its own stuff and that is getting worse over time.

I wonder what a complete release history of W10 + all of its updates + release notes of everything would look like!
 

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

18xx or 19xx? I'm lost

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

If I understand Wikipedia W10 history well, that means the bug/issue was introduced by release 1809 (October 2018), 6 months after v1803 and 17 months ago, where all we can get today is v1909?

As a aside, latest "working" version is 1803 with end of support due May 12, 2020.

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

..quite right @jchd. So there is no way around but to look at the issue.
The simple solution would be, a thread for gui and another for non-gui ( internally, not to bring mutithread to the product ), separating it, as to future proof the product.
( product = AutoIt ) 

But I'm not a programmer. All there is to do from now on, is wait for the Overlord :)  
On my side as a scripter, my solution is to fork the GUI away from the heavier stuff in the script, if I had a heavy script. ( my 2 cents )

In a new version, a build-in IPC would be very good to have ( request ) :baby:

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 2 weeks later...

Hello. I did not notice this thread before. I got the issue under Windows 10 Pro N Version 1709.

I also get the issue after a Sleep call.

Issue with Running as x64 and x86.

#RequireAdmin does not reduce the issue to me.

 

Saludos

 

Edited by Danyfirex
Typos
Link to comment
Share on other sites

59 minutes ago, Danyfirex said:

I also get the issue after a Sleep call.

Are you sure?  I can't reproduce that.

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

 

@jchd Yes I'm sure. check gif. I also get the issue if I activate an external window like WinActivate("Untitled - Notepad")

Untitled.gif.92d3af18305e4fb0e5c50309e5f56ec1.gif

Saludos

Link to comment
Share on other sites

After looking closer, it appears it isn't exactly so.

Surprisingly, only the first loop is slowed down!  This is why you find such a difference.

#include <Array.au3>

Func timeit()
    Local $x, $t = TimerInit()
    For $i = 1 To 500000
        $x += 1
    Next
    Return TimerDiff($t)
EndFunc

Local $Runs = 10
Local $n = $Runs + 4
Local $times[$n][4]

For $i = 0 To $Runs - 1
    $times[$i][0] = $i
Next

For $i = 0 To $Runs - 1
    $times[$i][1] = Round(timeit(), 1)
Next

Sleep(1000)

For $i = 0 To $Runs - 1
    $times[$i][2] = Round(timeit(), 1)
Next

For $i = 0 To $Runs - 1
    $times[$i][3] = Round($times[$i][2] - $times[$i][1], 1)
    $times[$n - 3][1] += $times[$i][1]
    $times[$n - 3][2] += $times[$i][2]
Next
$times[$n - 3][3] = Round($times[$n - 3][2] - $times[$n - 3][1], 1)

$times[$n - 4][0] = "====="
$times[$n - 4][1] = "======="
$times[$n - 4][2] = "======="
$times[$n - 4][3] = "======="
$times[$n - 3][0] = "Total"
$times[$n - 1][0] = "Average"
$times[$n - 1][1] = Round($times[$n - 3][1] / ($n - 3), 1)
$times[$n - 1][2] = Round($times[$n - 3][2] / ($n - 3), 1)
$times[$n - 1][3] = Round($times[$n - 3][3] / ($n - 3), 1)

Local $fRatio = Round(($times[0][2] / $times[0][1] - 1) * 100, 2)
Disp("First loop is", $fRatio)

$fRatio = Round(((($times[$n - 3][2] - $times[0][2]) / ($times[$n - 3][1] - $times[0][1])) - 1), 2)
Disp("Subsequent loops are", $fRatio)

$fRatio = Round(($times[$n - 3][2] / $times[$n - 3][1] - 1) * 100, 2)
Disp("Complete run is", $fRatio)

_ArrayDisplay($times, "Results", "", 0, Default, "Run #|Before sleep|After sleep|Difference")

Func Disp($s, $f)
    ConsoleWrite("" & StringFormat("%-20s% 6.2f", $s, Abs($f)) & ($f > 0 ? "% slow" : "% fast") & "er after Sleep()" & @LF)
EndFunc

The core really needs a serious review.  BUT, this particular slowdown may be due to resync within the OS multitasking scheduler granularity after a "long" sleep, even if I find the extra wait time a bit long.  Yet I think we can live with this as it doesn't seem to affect subsequent code significantly, if at all.  The permanent slowdown after window calls is much more severe.

Can you guys test under you own PC? and report?  (Run several times, as result vary)

I notice that the slowdown often vanishes when the Sleep() time is reduced to much lower values like 10, 20, 30.

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

This is my ouput with your example:

First loop is        143.64% slower after Sleep()
Subsequent loops are  0.07% slower after Sleep()
Complete run is      20.85% slower after Sleep()

You're right, but If I have/need/put a sleep in my for It will slow down too. Check removing the sleep(1000) and add sleep(100) inside second for in your code like:

For $i = 0 To $Runs - 1
    Sleep(100)
    $times[$i][2] = Round(timeit(), 1)
Next

This is my ouput with the change above. 

First loop is        121.31% slower after Sleep()
Subsequent loops are  1.06% slower after Sleep()
Complete run is      107.12% slower after Sleep()

 

@jchd nice average code 👏

PD: Sorry If I'm not using syntax highlighting My 30Kbs connection don't want to load the required resource to use the syntax highlight feature.

 

Saludos

Link to comment
Share on other sites

Replace Sleep(1000) by _Sleep(1000) to fix the issue:

Func _Sleep($ms)
    Local $t = _WinAPI_GetTickCount64() + $ms
    Do
    Until _WinAPI_GetTickCount64() >= $t
EndFunc

Restrict use to short values to avoid melting silicon down!

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

With Sleep I get for 5 runs on Windows 10 1803:

First loop is        34.87% faster after Sleep()
Subsequent loops are  0.05% faster after Sleep()
Complete run is       9.35% faster after Sleep()

First loop is        32.78% faster after Sleep()
Subsequent loops are  0.08% faster after Sleep()
Complete run is      11.84% faster after Sleep()

First loop is        52.93% faster after Sleep()
Subsequent loops are  0.05% faster after Sleep()
Complete run is      14.68% faster after Sleep()

First loop is        52.72% faster after Sleep()
Subsequent loops are  0.07% faster after Sleep()
Complete run is      16.25% faster after Sleep()

First loop is        38.24% faster after Sleep()
Subsequent loops are  0.05% faster after Sleep()
Complete run is      10.49% faster after Sleep()

With _Sleep I get:

First loop is        28.79% faster after _Sleep()
Subsequent loops are  0.05% faster after _Sleep()
Complete run is       8.00% faster after _Sleep()

First loop is         3.01% faster after _Sleep()
Subsequent loops are  0.03% slower after _Sleep()
Complete run is       2.71% slower after _Sleep()

First loop is        16.46% faster after _Sleep()
Subsequent loops are  0.03% faster after _Sleep()
Complete run is       4.91% faster after _Sleep()

First loop is        23.91% faster after _Sleep()
Subsequent loops are  0.03% faster after _Sleep()
Complete run is       5.82% faster after _Sleep()

First loop is        29.79% faster after _Sleep()
Subsequent loops are  0.12% faster after _Sleep()
Complete run is      13.76% faster after _Sleep()

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@jchd _Sleep(1000) remove the Issue but I think is more like a patch rather a full solution. ( of course because the solution will be change something inside AutoIt 😕)

 

Saludos

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...