General > The Laboratory

xlat is pretty fast

(1/8) > >>

jj2007:

--- Code: ---Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz (SSE4)

394     cycles for 100 * xlat
458     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

386     cycles for 100 * xlat
457     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

387     cycles for 100 * xlat
457     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

387     cycles for 100 * xlat
458     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

13      bytes for xlat
14      bytes for movzx eax, byte ptr[ebx+ecx]

72      = eax xlat
72      = eax movzx eax, byte ptr[ebx+ecx]
--- End code ---


--- Code: ---align_64
NameA equ xlat ; assign a descriptive name for each test
TestA proc
  mov ebx, offset somestring
  push 99
  .Repeat
xor ecx, ecx ; 256
align 4
.Repeat
mov eax, ecx
xlat ; mov al,[ebx+al]
dec ecx
.Until Sign?
dec stack
  .Until Sign?
  pop edx
  ret
TestA endp

align_64
NameB equ movzx eax, byte ptr[ebx+ecx]
TestB proc
  mov ebx, offset somestring
  push 99
  .Repeat
xor ecx, ecx ; 256
align 4
.Repeat
movzx eax, byte ptr[ebx+ecx] ; mov al,[ebx+al]
dec ecx
.Until Sign?
dec stack
  .Until Sign?
  pop edx
  ret
TestB endp

--- End code ---

zedd151:

--- Code: ---Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz (SSE4)

500     cycles for 100 * xlat
480     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

500     cycles for 100 * xlat
481     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

500     cycles for 100 * xlat
479     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

501     cycles for 100 * xlat
480     cycles for 100 * movzx eax, byte ptr[ebx+ecx]

13      bytes for xlat
14      bytes for movzx eax, byte ptr[ebx+ecx]

72      = eax xlat
72      = eax movzx eax, byte ptr[ebx+ecx]

--- ok ---
--- End code ---


Looks like a mixed bag. A little slower for my machine.
Been a little while since the last algo speed tests

HSE:
 :thumbsup:

But for Test A must be
--- Code: ---xor eax, eax
...
dec eax
--- End code ---
without mov eax, ecx ¿No?

jj2007:

--- Quote from: HSE on September 19, 2022, 08:28:21 AM --- :thumbsup:

But for Test A must be
--- Code: ---xor eax, eax
...
dec eax
--- End code ---
without mov eax, ecx ¿No?

--- End quote ---

xlat changes al. So you can't use eax as the loop counter.

HSE:
 :biggrin: :biggrin: Sorry.

Yet, that mov eax, ecx make comparison unfair.

Navigation

[0] Message Index

[#] Next page

Go to full version