Daniel W. Posted June 13, 2006 Share Posted June 13, 2006 (edited) Hi, i did this to learn AutoIT bit more but wOuter told me its a bit faster then the other one so here it is: Func StringReverse( $s_string ) Local $string If StringLen($sString) >= 1 Then Local $split = StringSplit( $s_string , '' ) For $b = $split[0] to 1 Step -1 $string &= $split[$b] Next Return $string Else SetError(1) Return "" EndIf EndFunc Edited June 13, 2006 by Daniel W. --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
jvanegmond Posted June 13, 2006 Share Posted June 13, 2006 You can use TimerInt and TimerDiff to check if it's Really faster.. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Daniel W. Posted June 13, 2006 Author Share Posted June 13, 2006 wOuter did it [16:24] M-3vent | *HardCore* < 1 + 3 + 3 = 7 >: _StringReverse: 3136.18157484187 StringReverse_Mine: 3153.86767657846 StringReverse_Dan: 2469.65613484093 [16:24] M-3vent | *HardCore* < 1 + 3 + 3 = 7 >: using the same errorhandeling as in _StringReverse --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
jvanegmond Posted June 14, 2006 Share Posted June 14, 2006 If you want it really fast you can strip out things like error checking etc. this will make it fly. Func StringReverse( $s_string ) Global $string Local $split = StringSplit( $s_string , '' ) For $b = $split[0] to 1 Step -1 $string &= $split[$b] Next EndFunc github.com/jvanegmond Link to comment Share on other sites More sharing options...
Daniel W. Posted June 14, 2006 Author Share Posted June 14, 2006 Thats not what i want ... I just want a function that does the same but that i made. The faster speed is just something that happened without my idea --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
Developers Jos Posted June 14, 2006 Developers Share Posted June 14, 2006 If you want it really fast you can strip out things like error checking etc. this will make it fly.Is this statement based on a test or guess? would surprise me if a bit of error checking at the beginning would even be measurable....Thats not what i want ...I just want a function that does the same but that i made. The faster speed is just something that happened without my idea My guess is that the real reason for this version to be faster is because of the usage of &=, which make "added on to a string" faster...... Before the separation of the Production and Beta includes we tried to make the UDF's work in both versions so this wasn't an option... now it is... 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...
Daniel W. Posted June 14, 2006 Author Share Posted June 14, 2006 I have rewritten some other string functions and noticed that StringTrimRight/Left takes "much" time , so it mustn't be &= ... --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] 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