Bizzaro Posted January 11, 2016 Author Share Posted January 11, 2016 (edited) Hi guys.I've spent several months working on my own business selling software and I've come across a very strange and easily reproducible bug.So basically, no matter what memory reading UDF I've used I've encountered the same bug.So if we create a compiled exe with a for loop that runs the function below function 5,000 times it will work flawlessly and smoothly in Windows 10. But in ANY other Windows OS it lags like crazy. I've tested this on separate computers running the target OS AND by simply placing the compiled exe in compatibility mode.You can easily test this yourself with the extremely simple script below...All this does it read the memory 5,000 times of SciTe's window and then creates a tooltip. Now run it in windows 10 and it is fast as hell, but then set the compatibility mode to Window 8 or anything else and you'll see just how massive the performance drop is when reading the memory.Just watch the tooltip as you move the mouse across the screen.I thought this was simply a problem with KDmemory but I now think it is a deeper problem in AutoIt. I've tried the Beta versions of Autoit too.I've also attached the UDF which contains the function _KDMemory_ReadProcessMemory()#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=bugtest.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "KDMemory2.au3" $processName = "SciTe.exe" $processId = ProcessExists($processName) $handles = _KDMemory_OpenProcess($processId) HotKeySet("{END}", "Quit") While 1 For $i = 1 To 5000 Step 1 $Name = _KDMemory_ReadProcessMemory($handles, 0x5fdd75e1, "Char[14]", 0) Next ToolTip($Name) WEnd Func Quit() ToolTip('') Exit EndFunc ;==>QuitI spent an awfully long amount of time searching the net for an answer as to why performance might be so vastly different and I'm at my wits end. I've searched high and low for an answer.KDMemory2.au3 Edited January 11, 2016 by Bizzaro Link to comment Share on other sites More sharing options...
JohnOne Posted January 11, 2016 Share Posted January 11, 2016 Does not do anything on my win 10 except use a whole lot of cpu. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted January 11, 2016 Share Posted January 11, 2016 Msgbox never appears despite only 2 loops, or regardless of memory address.#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=bugtest.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "KDMemory2.au3" $processName = "SciTe.exe" $processId = ProcessExists($processName) $handles = _KDMemory_OpenProcess($processId) HotKeySet("{END}", "Quit") $Timer = TimerInit() While 1 For $i = 1 To 2 Step 1 $Name = _KDMemory_ReadProcessMemory($handles, 0x0, "Char[14]", 0) Next ToolTip($Name) WEnd MsgBox(0,"Time", TimerDiff($Timer)) Func Quit() ToolTip('') Exit EndFunc ;==>Quit AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2016 Moderators Share Posted January 11, 2016 (edited) Bizzaro,From my tests on Win7 it looks as if the major time waster in that code is the multiple ToolTip calls:5000 calls with no ToolTip calls: TimerDiff returns .7005000 calls with a toolTip on each pass: TimerDiff returns 14.3555000 calls but only calling ToolTip if the function return changes: TimerDiff returns .750Hence it would seem that the problem is in the ToolTip calls and not the memory UDF. Try running your script with a suitable condition like this:$sOldTip = "XXXXXXXXXXXXXXX" For $i = 1 To 5000 $Name = _KDMemory_ReadProcessMemory($handles, 0x5fdd75e1, "Char[14]", 0) If $Name <> $sOldTip Then $sOldTip = $Name ToolTip("Result: " & $Name) EndIf NextDoes that speed it up?M23Edit: And I am still waiting for you to explain why you need to read process memory in your script. The source of that UDF does not fill me with a lot of confidence that we should be offering you any assistance. Edited January 11, 2016 by Melba23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JohnOne Posted January 11, 2016 Share Posted January 11, 2016 I get similar when remove the silly while loop I never noticed.It occurs to me that win 10 is improved at some things as you would expect and memory reading is one of them. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Bizzaro Posted January 11, 2016 Author Share Posted January 11, 2016 I changed the code to remove the tooltip completely.The script now displays a messagebox with the TimerDiff.Even without the tooltip, the increase goes from 140 to 655 if the program is run in anything but Win10. This is without the tooltip. What i'm wondering is what changes using Win10 compatibility mode which could affect the script this way?#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=bugtest.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "KDMemory2.au3" $processName = "SciTe.exe" $processId = ProcessExists($processName) $handles = _KDMemory_OpenProcess($processId) HotKeySet("{END}", "Quit") Global $Timer =TimerInit() While 1 For $i = 1 To 5000 Step 1 $Name = _KDMemory_ReadProcessMemory($handles, 0x5fdd75e1, "Char[14]", 0) Next MsgBox(0,"Time", TimerDiff($Timer)) $Timer =TimerInit() WEnd Func Quit() ToolTip('') Exit EndFunc ;==>Quit Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2016 Moderators Share Posted January 11, 2016 Bizzaro,I suggest that JohnOne has already given you a likely answer: win 10 is improved at some things as you would expect and memory reading is one of themWhich suggests that you should direct your question towards a Windows forum rather than here.But as you seem unwilling to answer the question I have now asked you twice, I will assume that you do not wish to do so for the very reasons I asked it - and so this thread will now be closed.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2016 Moderators Share Posted January 12, 2016 Bizzaro,You took the time to write me a very uncomplimentary PM, but still did not explain why you need to read the process memory - thanks for confirming my decision.M23P.S. If you can convince me that your script does not break the forum rules, I would be ready to reopen the thread - you know where to find me and I do not hold grudges. 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts