flat assembler
Message board for the users of flat assembler.
Index
> Main > HELP: swaping between 3 array (fast routine)? |
Author |
|
DOS386 16 Aug 2007, 21:10
Code: array 1=a1[]=0 to 1000000 elements, containing number from 0 to 255 array 2=a2[]=0 to 255 elements, containing random numbers array 3=a3[]=0 to 1000000 elements,contain no number count=1000000*4 basic routine for n from 0 to 100000 by 1 do a3[n]=a2[a1[n]] end for Very ^^^ odd "BASIC" ; FASM code: mov esi,a1 mov ebx,a2 mov edi,a3 xor eax,eax ; MOV EAX,0 mov ecx,1000000 ; 1 M decimal or 999'999 only @@: mov al,[esi+ecx] mov al,[ebx+eax] mov [edi+ecx],al loop @b Note: dword ptr is crap and has been banned from FASM _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
16 Aug 2007, 21:10 |
|
f0dder 16 Aug 2007, 22:56
NTOSKRNL_VXE wrote: dword ptr is crap and has been banned from FASM Not really, in fasm it's just called "dword". And in the code snippet by the original poster, it wasn't necessary, not even for MASM, since the data size with register use is implicit. _________________ - carpe noctem |
|||
16 Aug 2007, 22:56 |
|
xspeed 17 Aug 2007, 16:56
hey thank
basic routine for n from 0 to 100000 by 1 do a3[n]=a2[a1[n]] end for Very ^^^ odd "BASIC" ; ^^^ maple v9.5 a math program with programming language basic: for n=0 to 100000 a3[n]=a2[a1[n]] next i hooked fasm to maple 9.5 my routine take about 75->90 tickcount for one run 8749 tickcount for 100 for i from 0 to 99 by 1 do for n from 0 to 100000 by 1 do a3[n]=a2[a1[n]] end do end do too slow 874 ticket for 100 would be nice 874 ticket for 1000 would be really nice something like the basic routine for transferring a2[n]=a1[n] with rep movsb |
|||
17 Aug 2007, 16:56 |
|
DOS386 18 Aug 2007, 05:24
> my routine take about 75->90 tickcount
Tested mine ? > something like the basic routine for transferring a2[n]=a1[n] with rep movsb SORRY but MOVSx doesn't index via a 3rd array ... just post a feature request for SSSSSE 5 |
|||
18 Aug 2007, 05:24 |
|
Mac2004 18 Aug 2007, 07:06
xspeed: Could you please use code tags? Your code is much more readable that way...
regards, Mac2004 |
|||
18 Aug 2007, 07:06 |
|
xspeed 20 Aug 2007, 14:32
NTOSKRNL_VXE=60->70 tickcount*100 times=6547
tickcount=GetTickCount in kernel32.lib/dll 6547=6.547 sec can you reduce it down to .654 sec for 100 times with 1000001 long value elements=4000004 bytes? |
|||
20 Aug 2007, 14:32 |
|
Plue 20 Aug 2007, 19:56
The elements are all dword sized, right?
Edit: This is my fastest yet: Code: mov eax, [v_a] ; eax <- address of a[0] mov ebx, [v_b] ; ebx <- address of b[0] mov ecx, [v_c] ; ecx <- address of c[0] mov edx, 100000*4 ; edx <- counter lp: sub edx, 4 mov esi, [eax+edx] mov esi, [ebx+esi] mov [ecx+edx], esi jnz lp You can probably get it much faster by changing the algorithm a bit. What do you need it for? |
|||
20 Aug 2007, 19:56 |
|
xspeed 23 Aug 2007, 16:07
direct swapping them would be the fastest but i dont know how
anyone have a clue on how to swap them faster? plue: for a new encode/media format file |
|||
23 Aug 2007, 16:07 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.