Site
News
Files Visual Basic
Strings
Math
General
Properties
Memory
Methods Search
Testing Inline ASM-VB
Strings
Math
General
Memory Search
Using inline ASM
Submit!
News
Files Visual Basic
Strings
Math
General
Properties
Memory
Methods Search
Testing Inline ASM-VB
Strings
Math
General
Memory Search
Using inline ASM
Submit!
ASMLCase vs. VB LCase$()This short ASM code will quickly process strings and makes the characters lowercase
Have a look, it speeds up your LCase$() (or UCase$()) code with a factor of around 200%.
User contributed notes:
Have a look, it speeds up your LCase$() (or UCase$()) code with a factor of around 200%.
'//How-to use this code: '//Simply: Call ASMLCase(strTest1) '//No pointer stuff. That's all. '//Note: Not tested on "weird" international characters. Only on "normal" text. Public Sub ASMLCase(ByVal MyString As String) '//from: http://board.win32asmcommunity.net/showthread.php?s=7cd002fb108305b12d8572cd2a3f9dda&threadid=8330 '#ASM_START ' push ebp ' mov ebp, esp ' push edx ' push edi ' mov edi, [ebp+8] 'str_lcase: ' mov eax, [edi] ' mov edx, eax ' and edx, 00400040h ' ror edx, 1 ' or eax, edx ' mov [edi], eax ' Add edi, 4 ' lea edx, [eax-00010001h] ' xor eax, edx ' and eax, 00800080h ' jz str_lcase ' and eax, edx ' jz str_lcase ' pop edi ' pop edx ' mov esp, ebp ' pop ebp ' ret '#ASM_END End Sub |
VBLCase$ % faster than ASMLCase | VBLCase$ (sec) | ASMLCase (sec) |
-76.4% | 0.07684 | 0.325046 |
263.8% | 1.246445 | 0.342576 |
221.1% | 1.249015 | 0.389014 |
294.4% | 1.292397 | 0.327705 |
249% | 1.368006 | 0.391964 |
VBLCase$ % faster than ASMLCase | VBLCase$ (sec) | ASMLCase (sec) |
279.8% | 6.650534 | 1.751089 |
264% | 7.024404 | 1.929564 |
257.6% | 7.327672 | 2.049311 |
294.4% | 7.405174 | 1.877762 |
287.3% | 7.026479 | 1.814199 |
VBLCase$ % faster than ASMLCase | VBLCase$ (sec) | ASMLCase (sec) |
253.1% | 13.485712 | 3.81889 |
264.3% | 13.80551 | 3.789234 |
294.3% | 14.724604 | 3.734029 |
300% | 13.875873 | 3.468981 |
234.8% | 13.830592 | 4.130574 |
User contributed notes:
Author: Almar Joling () | Date: 19:03 01/03/2004 |
testing :) | |
Author: Timothy Patrick () | Date: 18:03 15/03/2004 |
This ASM code might be embedded right in this function, but is there an ASM alternative to the "Len" function? | |
Author: Almar Joling () | Date: 12:03 20/03/2004 |
Yeah, I once made it, but the performance of it wasn't that much better than the Len() (regarding to strings). I might post it this weekend though. I still need to fix a few quirks on this site, improvin the comments system a bit. :) |
|
Author: anonymous lurker () | Date: 13:04 13/04/2004 |
shouldnt that really have ret 4 at the end instead of a ret, because you pass 1 parameter on the stack? | |
Author: sluggy () | Date: 06:09 13/09/2004 |
No, "ret" is fine, it is actually a macro which MASM expands out to "ret |
|
Author: sluggy () | Date: 06:09 13/09/2004 |
Oops, some of my previous post is missing... "ret" gets expanded by MASM to "ret [number of bytes that need fixin']" | |
Author: mix (admin at rogerstudio dot com) | Date: 16:11 12/11/2005 |
yes ,but how to compile that code ? this code is in comments , no ? this function will do anything. |
|
Author: mix (admin at rogerstudio dot com) | Date: 16:11 12/11/2005 |
escuse for this note , i havent read the "using inline asm". |
|
Author: Almar () | Date: 18:11 12/11/2005 |
Check outt he forums, there's some people working on a VB plugin called" ThunderVB" which is very cool, support ASM and everything :) |