flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3, 4 Next |
Author |
|
HaHaAnonymous 09 Feb 2013, 19:21
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:38; edited 2 times in total |
|||
![]() |
|
sleepsleep 09 Feb 2013, 19:22
i think i found where the problem,
ok, here the output for 1,000,000 unique string number 1,000,000 unique string number input could be downloaded from here (5.28 MB) http://www.sinimari.com/ascii.7z Quote:
modify ESI if you don't want to run 1,000,000 unique string number Code: mov esi,1000000 mov ebx,string1 ascii2d_start: cmp esi,0 je ascii2d_end stdcall sleepsleep_ascii2d,ebx dec esi @@: inc ebx cmp byte [ebx], 0 jne @b inc ebx jmp ascii2d_start ascii2d_end: invoke GetTickCount mov ecx,[_starttime] sub eax,ecx
Last edited by sleepsleep on 09 Feb 2013, 19:31; edited 1 time in total |
|||||||||||
![]() |
|
sleepsleep 09 Feb 2013, 19:28
HaHaAnonymous wrote: I have to follow the rules of registers preservation or it just needs to use the "stdcall" calling convention? stdcall, preserve ESI, EBX, EDI replace my function to your function Code:
stdcall sleepsleep_ascii2d,ebx
as i already perform the loading ascii string for you, so everybody would use same loading time. please note that, you need to download 1,000,000 input file if you want to test, but maybe i should make one 10,000,000 input file, the time is too fast. i think, maybe something wrong with my GetTickCount, you guys please advice, i tried 2,000,000 input, still 78... damn it. Last edited by sleepsleep on 09 Feb 2013, 19:39; edited 1 time in total |
|||
![]() |
|
HaHaAnonymous 09 Feb 2013, 19:37
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:38; edited 3 times in total |
|||
![]() |
|
sleepsleep 09 Feb 2013, 19:42
AsmGuru62 wrote: @2sleep: also how the code called must be defined. ok, maybe we should use QueryPerformanceTimer, please donate code ![]() this would be a fun game for everybody |
|||
![]() |
|
HaHaAnonymous 09 Feb 2013, 19:49
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:37; edited 1 time in total |
|||
![]() |
|
HaHaAnonymous 09 Feb 2013, 20:07
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:37; edited 3 times in total |
|||
![]() |
|
AsmGuru62 10 Feb 2013, 00:10
@2sleep: you're should be the one to test all our code!
We send our code and you hook it up to the same testing code on the same (yours) system. And measure with QueryPerformanceCounter. Then it would be somewhat interesting. And your test file has invalid strings - some values are out of range. P.S. I can code the testing framework and send it to you. You just call everyone's function and report results. |
|||
![]() |
|
sleepsleep 10 Feb 2013, 00:37
ok =) asmguru, no problem =)
regarding the out of range, the 1,000,000 5mb file shouldnt have those values, or am i wrong? thanks haha, let see how those proc benchmark later =) |
|||
![]() |
|
revolution 10 Feb 2013, 00:56
Hmm, I'm still struggling to imagine a situation where I need to do millions upon millions of ASCII/dword conversions per second, and do them hyper-quickly, else my program will fail and be unusable.
![]() |
|||
![]() |
|
AsmGuru62 10 Feb 2013, 15:00
It usually needed for reporting/scanning software.
Imagine that you need to return results from SQL a query into a TXT file. If result set is large (into thousands of rows and every cell is a value), so you get a huge file with numbers. Then you need to read that file and do some sub-queries on these values (which are now ASCII values). Can be other cases where you need to read and process a lot of ASCII Integer values. Of course, your code will not fail or be unusable, but it will process a lot of info more slowly, than other, more optimized solution. Besides, measuring the code speed is interesting in a way that sometimes it gives unexpected results. |
|||
![]() |
|
revolution 11 Feb 2013, 02:57
AsmGuru62 wrote: It usually needed for reporting/scanning software. AsmGuru62 wrote: Besides, measuring the code speed is interesting in a way that sometimes it gives unexpected results. ![]() |
|||
![]() |
|
sleepsleep 11 Feb 2013, 03:43
it is a game,
please play, revolution, =) for fun, and experience =P |
|||
![]() |
|
uart777 11 Feb 2013, 04:45
Here's a runtime macro that converts a byte to hexadecimal text fast. An "itoa" function could use this if n<256. It takes an extra 512 bytes so it may only be worthwhile for certain programs that require the fastest number-text conversions; scripting languages, disassemblers.
Code: ; let eax=n, eax&0FFh, edx=&[hbt+eax*2],\ ; cx=[edx], eax=t, [eax]=cx, eax+2, byte [eax]=0 macro hb2t n, t { mov eax, n and eax, 0FFh ; ensure 0-255 lea edx, [hbt+eax*2] mov cx, [edx] mov eax, t mov [eax], cx add eax, 2 ; return advanced address mov byte [eax], 0 ; terminate t } ; h byte lookup table (512 bytes) hbt: db \ '00','01','02','03','04','05','06','07',\ '08','09','0A','0B','0C','0D','0E','0F',\ '10','11','12','13','14','15','16','17',\ '18','19','1A','1B','1C','1D','1E','1F',\ '20','21','22','23','24','25','26','27',\ '28','29','2A','2B','2C','2D','2E','2F',\ '30','31','32','33','34','35','36','37',\ '38','39','3A','3B','3C','3D','3E','3F',\ '40','41','42','43','44','45','46','47',\ '48','49','4A','4B','4C','4D','4E','4F',\ '50','51','52','53','54','55','56','57',\ '58','59','5A','5B','5C','5D','5E','5F',\ '60','61','62','63','64','65','66','67',\ '68','69','6A','6B','6C','6D','6E','6F',\ '70','71','72','73','74','75','76','77',\ '78','79','7A','7B','7C','7D','7E','7F',\ '80','81','82','83','84','85','86','87',\ '88','89','8A','8B','8C','8D','8E','8F',\ '90','91','92','93','94','95','96','97',\ '98','99','9A','9B','9C','9D','9E','9F',\ 'A0','A1','A2','A3','A4','A5','A6','A7',\ 'A8','A9','AA','AB','AC','AD','AE','AF',\ 'B0','B1','B2','B3','B4','B5','B6','B7',\ 'B8','B9','BA','BB','BC','BD','BE','BF',\ 'C0','C1','C2','C3','C4','C5','C6','C7',\ 'C8','C9','CA','CB','CC','CD','CE','CF',\ 'D0','D1','D2','D3','D4','D5','D6','D7',\ 'D8','D9','DA','DB','DC','DD','DE','DF',\ 'E0','E1','E2','E3','E4','E5','E6','E7',\ 'E8','E9','EA','EB','EC','ED','EE','EF',\ 'F0','F1','F2','F3','F4','F5','F6','F7',\ 'F8','F9','FA','FB','FC','FD','FE','FF' ; example with my Z77 library... include 'z.inc' use hbyte TEXT t(64), f(32)='Result: %th', tn(4) code hb2t 07Fh, tn print t, f, tn say t exit |
|||
![]() |
|
HaHaAnonymous 11 Feb 2013, 05:31
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:35; edited 1 time in total |
|||
![]() |
|
JohnFound 11 Feb 2013, 05:41
I like games
![]() Here is my procedure. It is named "Dec2Num" because it converts decimal numbers (only unsigned) from ASCII to dword. Also, it does not check the string for invalid characters (should it?): Code: UDec2Num: mov ecx, [esp+4] xor edx, edx xor eax, eax .loop: mov dl, [ecx] inc ecx test dl, dl jz .ends lea eax, [5*eax] sub dl, '0' shl eax, 1 add eax, edx jmp .loop .ends: retn 4 Last edited by JohnFound on 11 Feb 2013, 07:13; edited 2 times in total |
|||
![]() |
|
HaHaAnonymous 11 Feb 2013, 05:50
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:34; edited 1 time in total |
|||
![]() |
|
JohnFound 11 Feb 2013, 06:07
[EDIT] See my next posts - there is a faster implementation of this algorithm.[/EDIT]
Ah, OK, I will fix it. Just a second: Code: johnfound_ascii2d: xor eax, eax xor ecx, ecx xor edx, edx xchg ecx, [esp+4] cmp byte [ecx], '-' jne .loop inc ecx dec dword [esp+4] .loop: mov dl, [ecx] inc ecx test dl, dl jz .ends lea eax, [5*eax] sub dl, '0' shl eax, 1 add eax, edx jmp .loop .ends: xor eax, [esp+4] sub eax, [esp+4] retn 4 [EDIT]Fixed name and STDCALL convention. Code cleanup.[/EDIT] Last edited by JohnFound on 11 Feb 2013, 09:38; edited 4 times in total |
|||
![]() |
|
HaHaAnonymous 11 Feb 2013, 06:14
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:34; edited 1 time in total |
|||
![]() |
|
Goto page Previous 1, 2, 3, 4 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.