Champak Posted July 19, 2023 Share Posted July 19, 2023 In situations where I can use If, Switch, or Select, which one is the fastest....not preference, but functionally more efficient and faster. The function I'll be doing will be cycling through 45 if, switch, or select. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 19, 2023 Developers Share Posted July 19, 2023 What is stopping you from testing this yourself? Andreik and TheXman 1 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Champak Posted July 19, 2023 Author Share Posted July 19, 2023 Nothing is stopping me from testing it beyond I am working on something else at the moment and it wouldn't be difficult or time consuming for someone who readily has the knowledge and answer to provide it so when I'm done I can get right into it without doing something extra that is time consuming. Link to comment Share on other sites More sharing options...
RTFC Posted July 19, 2023 Share Posted July 19, 2023 Switch is fastest. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
Developers Jos Posted July 19, 2023 Developers Share Posted July 19, 2023 Quick search of the site gives you the number of times this was asked already and answered https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fwww.autoitscript.com+faster+switch+or+if&rlz=1C1WHAR_nlNL1056NL1056&oq=site%3Ahttps%3A%2F%2Fwww.autoitscript.com+faster+switch+or+if+&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRg60gEJMzYzMTZqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8 somdcomputerguy 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Champak Posted July 19, 2023 Author Share Posted July 19, 2023 I actually did do a search with "switch" and "if" in the title but "if" wouldn't return any results...(I guess too common of a word?)... and I got too many unrelated results, that's why I asked. Thank you, I'll remember to search through google when needing common words. Link to comment Share on other sites More sharing options...
mistersquirrle Posted July 19, 2023 Share Posted July 19, 2023 (edited) Just because I've had the same question and tested this a bit myself, here's results from a test that I ran in 2018: From this, Switch was always the fastest, and if you can, you should set/keep OnEventMode off. Things depend though, and you may not be able to always use Switch, or the different logic needed to get a specific way working may introduce additional slowdowns Edit: Just to be clear, the OnEventMode stuff doesn't have any direct connection/impact with Select/Switch/If, it's just something else that I was testing at the same time. In general things are a bit slower with OnEventMode, not just Select/Switch/If Edited July 19, 2023 by mistersquirrle argumentum 1 We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
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