Jump to content
Sign in to follow this  
Jon

AutoIt v3.3.11.4 Beta

Recommended Posts

iCode,

When I run your code on my Win7 x86 system I get the following results:

Average over 100 Sleep(10):

3.3.10.2: 10.005
3.3.11.4: 10.120
I think the problem lies elsewhere. ;)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

As far as I know, AutoIt's Sleep() function is different than the Sleep() function in the Kernel32.dll.

AutoIt uses timer to implement that, and that's exactly why the delay can't be less than 10ms.

 

Maximum sleep time is 2147483647 milliseconds (24 days) and the minimum is 10 milliseconds. So using 1-9 will automatically default to 10 milliseconds.

 

If you really need to sleep less than 10ms, try the other Sleep function.

DllCall("kernel32.dll", "none", "Sleep", "DWORD", 1)

But, seriously, use it only when you want to sleep less than 10ms.

Share this post


Link to post
Share on other sites

Currently the precision of Sleep depends on global Windows setting which can be influenced by any third party application. One user can really have 10ms sleep for Sleep(10), and some other can have, for example 24ms sleep period for the same call.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

There is indeed significant dispersion in timed values.

Local Const $limit = 50000
Local $values[51]
Local $t, $n

For $i = 1 To $limit
    $t = TimerInit()
    Sleep(10)
    $n = Round(TimerDiff($t))
    $values[$n] += 1
Next
For $i = 0 To UBound($values) - 1
    $t = $values[$i]
    If $t Then
        $n = Round((800 * $t) / $limit) / 8
        $values[$i] = (Int($n / 8)) ? _StringRepeat(ChrW(0x2588), Int($n / 8)) : ''
        $n = Mod($n, 8)
        If $n Then $values[$i] &= ChrW(0x2588 + 8 - $n)
        $values[$i] &= ' ' & $t
    EndIf
Next
_ArrayDisplay($values)

2014-04-19_133341.png

I've found the need to increase possible times to 50ms since I've encountered values > 35ms.

The sample above was obtained while doing other foreground task.


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)

Share this post


Link to post
Share on other sites

It was more fun than mere timing!

It's prettier in console but that would need Unicode display.

All kind of asciified statistic graphs are useful within databases, using views, ad hoc statistic functions and a bit of care.


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)

Share this post


Link to post
Share on other sites

@Melba23 - try both 32 and 64 bit, release and beta - i would guess you'll probably experience very different results as i and @jchd did

@D4RKON3 - i agree, but just a note to others who stumble upon this that the dll call, in a tight loop with small values, will hog the CPU...

; CPU hog with small values...
While 1
    DllCall("kernel32.dll", "none", "Sleep", "DWORD", 1)
Wend

anyway, no big deal, but i think the help file should be updated to reflect the inaccuracy of Sleep at smaller values (so far it looks like values < 17 are problematic)


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites

iCode,

This are the results I get while simultaneously streaming and doing other foreground work as well on my x86 machine:

Beta        Release
[0]|
[1]|
[2]|
[3]|
[4]|
[5]|
[6]|
[7]|
[8]|
[9]|  1140  1481
[10]| 45251 43852
[11]| 1003  1320
[12]| 544   653
[13]| 407   493
[14]| 271   371
[15]| 208   288
[16]| 169   201
[17]| 108   147
[18]| 112   103
[19]| 73    103
[20]| 61    82
[21]| 62    67
[22]| 48    66
[23]| 40    64
[24]| 32    39
[25]| 30    34
[26]| 21    43
[27]| 25    39
[28]| 22    49
[29]| 29    33
[30]| 17    36
[31]| 21    33
[32]| 16    27
[33]| 25    26
[34]| 16    30
[35]| 15    22
[36]| 20    14
[37]| 14    17
[38]| 9     15
[39]| 11    16  
[40]| 15    14
[41]| 17    13
[42]| 14    17
[43]| 7     7
[44]| 3     15
[45]| 5     13
[46]| 7     9
[47]| 7     6
[48]| 5     10
[49]| 7     4
[50]|
If you want to donate an x64 box for me to run tests on that I would be happy to do so. ;)

But the main point I take from this is that if you want real timing accuracy then an interpreted language is probably not the best way to go given the inherent problems. But I will add something to the Help file explaining that the timings are only approximate and under 10 is not honoured at all. :)

M23

Edit: Added comment to Help file.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

thanks @Melba23

FYI, here's the note i made in a code snippet regarding the sleep dll call..

; however, do NOT make the DllCall() if the sleep is going to be repeated in a tight loop, else funny things happen outside of script, such as Ctrl+L-click gets whacky when selecting multiple objects in Explorer
 


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...