Jump to content

Dll caching...


Recommended Posts

It’s true that _IsPressed(“01”) is significantly sped up when a dll is specified as a second optional argument, which is especially beneficial when called in a loop repeatedly.

Yet, other UDF functions typically have no such parameter. 
Is that because there is little benefit, or because they keep any dlls cached statically?

 

Code hard, but don’t hard code...

Link to comment
Share on other sites

Not sure we should call it significant.  I tested both with $hDLL (coming from DllOpen) and the usual "user32.dll" and it shows that with the handle it is close to 25% faster after 5000 calls.  Not bad if you look only at the percentage.

But the fact is that it's only 13ms faster.  Divided by 5000 it is a gain of 0.0026ms per call (not really significant IMO).  On the other hand, it doesn't hurt to specify it.

Recently we tested DllCall using an handle and without.  There was only few ms between both.  Maybe @pixelsearch can confirm cause I can't seem to find the thread.  There was a nice explanation from M23 too.  Anyway, the conclusion was that there is not much of an advantage to open DLL especially if it is a largely used DLL.  

Link to comment
Share on other sites

  • Moderators

Hi,

The thread and post mentioned by Nine:

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

 

Link to comment
Share on other sites

Yes, I agree after running a few tests, only a very modest benefit from using a pre-opened dll.

One other question though, if anyone has insight.  The underscore indicates that _IsPressed is not part of the core language, is that correct?  Does that mean it wasn’t in the original language, or?  

Ok, I lied, one other question about dlls, quite a number of solutions posted in this forum seem to rely on DllOpen and DllCall and setting up structs correctly to get stuff in and out of them.

But once somebody works out how to call the dll function properly, is there a way for them to just put a wrapper on it and add it to the collection?  Is that what the WinApi stuff is?

Thanks in advance.
 

 

Code hard, but don’t hard code...

Link to comment
Share on other sites

  • Moderators

JockoDundee,

Quote

The underscore indicates that _IsPressed is not part of the core language, is that correct?  Does that mean it wasn’t in the original language, or?

Core AutoIt functions do not have a leading underscore (e.g. FileReadToArray) while those that do (e.g. _FileReadToArray) are written in pure AutoIt and can be found in the standard UDF libraries - look in the "Include" folder of your AutoIt installation.

You might also come across functions with a double leading underscore - these are by convention "Internal Use Only" functions within a UDF. Meddle with them at your peril!

Quote

 just put a wrapper on it and add it to the collection?  Is that what the WinApi stuff is?

That is entirely correct - the "_WinAPI_*" functions are syntactic sugar for various API calls and were originally an external library managed by the author. They were added to the standard includes some time ago as they were proving such a useful addition to general AutoIt programming.

If you were to produce some nice API/DLL call wrapper functions then the place to put them is into the "Examples" section where they can be peer-reviewed by the community. If they are considered really useful then they may be taken into the standard includes, but as that means that the small number of people who manage this ever-expanding package have to take over the task of integrating all the various functions with any new version of the AutoIt core or Windows release this does not happen that often.

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

 

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