I don't know why I can't edit posts after I reloggedin.
I had another little idea optimizing the last tiny bit of speed...
>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\user\BWI\AutoIt\numbers.au3"
----------SHORT TEST----------
Generating random numbers...Done !
Doing test A...Done ! Result : 0.24618 sec(s)
Doing test B...Done ! Result : 0.12587 sec(s)
Doing test C...Done ! Result : 0.06766 sec(s)
----------LONG TEST----------
Generating random numbers...Done !
Doing test A...Done ! Result : 7.46660 sec(s)
Doing test B...Done ! Result : 3.72427 sec(s)
Doing test C...Done ! Result : 2.36960 sec(s)
>Exit code: 0 Time: 15.797
Only posting my optimizations... For full code snip it from my previous post.
I added the default value at index 0. This saves a subtraction by 1 every time. Then I just changed the global Array to have mixed content (strings and integers) which will save another comparison everytime and allows to return the result immediately. I know one shouldn't do this, but for the result is static it doesn't mess anything. There are 59 spaces in my array by the way. This optimization saves a peek over a third (36,3%) instead of a fourth compared to my nested switch-blocks before and a peek over two thirds (68,2%) compared to the linear switch-block of Valuater and FireFox.
Global $a_Keys[166] = [-1, "LeftMouse", "RightMouse", -1, "MiddleMouse", "X1Mouse", "X2Mouse", -1, _
"BACKSPACE", "TAB", -1, -1, "CLEAR", "ENTER", -1, -1, "SHIFT", "CTRL", "ALT", "PAUSE", _
"CAPSLOCK", -1, -1, -1, -1, -1, -1, "ESC", -1, -1, -1, -1, "SPACEBAR", "PAGE UP", "PAGE DOWN", _
"END", "HOME", "LEFT", "UP", "RIGHT", "DOWN", "SELECT", "PRINT", "EXECUTE", "PRINT SCREEN", _
"INS", "DEL", -1, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", -1, -1, -1, -1, -1, -1, _
-1, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", _
"S", "T", "U", "V", "W", "X", "Y", "Z", "LWin", "RWin", -1, -1, -1, "0'", "1'", "2'", "3'", _
"4'", "5'", "6'", "7'", "8'", "9'", "Multiply", "Add", "Separator", "Subtract", "Decimal", _
"Divide", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", _
-1, -1, "F16", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "NUM LOCK", _
"SCROLL LOCK", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "LSHIFT", "RSHIFT", _
"LCTRL", "RCTRL", "LMENU", "RMENU"]
; #FUNCTION# ===================================================================
; Name : __GetKeyByHex_ArrayBased_Samoth2
; Description: Returns Aplha key for specified key
; Parameter(s): None
; Requirement(s): None
; Return Value(s): On Success - Returns Key
; On Failure - Returns -1
; Author(s): Samoth
; Note(s): Thanks Valuater... 8)
;===============================================================================
Func __GetKeyByHex_ArrayBased_Samoth2($iKeyIn = 0)
$iKeyIn = Dec($iKeyIn)
If $iKeyIn > 165 Then Return -1
Return $a_Keys[$iKeyIn]
EndFunc ;==>__GetKeyByHex_ArrayBased_Samoth2