Sunaj Posted June 5, 2007 Posted June 5, 2007 Easy question (at least for a dev) here: is there any latency/speed gain associated with using Dll handles (made with dllopen..) in Dllcall? If yes is it big, small etc..? I realize that the difference will of course depend on the dll and the function used in question (fishing for generalities here). The pragmatic reason behind my question is that I have a script that uses about 5-10 dll calls for primary usage and a search and replace with some dllhandles, so that "user32.dll" becomes $dllUser32, would be fairly easy if there's gain to be had! Cheers, Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list]
lod3n Posted June 5, 2007 Posted June 5, 2007 I think It's only faster if you make more than 2 calls to any given DLL. You should run a test yourself and see if it's faster for you one way or the other. You can use TimerInit and TimerDiff to find out how many milliseconds in execution time you're getting. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
PaulIA Posted June 5, 2007 Posted June 5, 2007 Easy question (at least for a dev) here: is there any latency/speed gain associated with using Dll handles (made with dllopen..) in Dllcall? If yes is it big, small etc..? I realize that the difference will of course depend on the dll and the function used in question (fishing for generalities here). The pragmatic reason behind my question is that I have a script that uses about 5-10 dll calls for primary usage and a search and replace with some dllhandles, so that "user32.dll" becomes $dllUser32, would be fairly easy if there's gain to be had!Cheers,SunajI ran some tests on this when I first started designing Auto3Lib. The speed difference between keeping the handle open and using the string is very small. So small that I stopped caching the handles and switched to using the strings. Auto3Lib: A library of over 1200 functions for AutoIt
Sunaj Posted June 6, 2007 Author Posted June 6, 2007 I think It's only faster if you make more than 2 calls to any given DLL. You should run a test yourself and see if it's faster for you one way or the other. You can use TimerInit and TimerDiff to find out how many milliseconds in execution time you're getting.I ran some tests on this when I first started designing Auto3Lib. The speed difference between keeping the handle open and using the string is very small. So small that I stopped caching the handles and switched to using the strings.Thanks to you both for your answers, @lod3n: you're right on the TimerInit/Diff usage to get the specifics (and yep, I do use the calls more than 2 times over). @PaulIA: I can see why you would choose that course when developing something as huge as Auto3Lib, it is however very easy for me to open the few handles I need so think I'll go with that options since you both agree that there is some (more or less tangible) gain to be had. Thanks for helping out. [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now