Assembler optimisation - how to avoid a jump? (Developers)
I measured my original code, CM's code and another variant found on internet:
VARIANT 1:
sub edx,ecx
jnc @RLE_CLIP_MOVE_CONT
add ecx,edx
@RLE_CLIP_MOVE_CONT:
VARIANT 2:
sub edx, ecx
rcr eax, 1
sar eax, 31
and eax, edx
add ecx, eax
VARIANT 3:
sub edx,ecx
sbb eax,eax
and eax,edx
add ecx,eax
Differences are small. Variants 2 and 3 are slightly faster then V1. Difference between V2 and V3 is only borderly significant, maybe V3 is sligtly faster but measurement would be must done in pure DOS, not in Win98 I am running just now.
I made test only on Pentium 4 machine, due lack of time I haven't tested on my Pentium III.
---
DOS-u-akbar!
Complete thread:
- Assembler optimalisation - how to avoid a jump? - Laaca, 13.05.2012, 20:38 (Developers)
![Open in board view [Board]](img/board_d.gif)
![Open in mix view [Mix]](img/mix_d.gif)
- Assembler optimalisation - how to avoid a jump? - Rugxulo, 13.05.2012, 21:10
- Assembler optimalisation - how to avoid a jump? - Laaca, 13.05.2012, 22:15
- Assembler optimalisation - how to avoid a jump? - marcov, 13.05.2012, 23:22
- Assembler optimalisation - how to avoid a jump? - Laaca, 13.05.2012, 22:15
- Assembler optimisation - how to avoid a jump? - ecm, 13.05.2012, 23:32
- Assembler optimisation - how to avoid a jump? - Laaca, 14.05.2012, 18:15
- Assembler optimisation - variant 3, sbb - ecm, 14.05.2012, 18:22
- Assembler optimisation - how to avoid a jump? - Rugxulo, 16.05.2012, 10:34
- Assembler optimisation - how to avoid a jump? - bretjohn, 16.05.2012, 16:42
- Assembler optimisation - speed, size, etc - ecm, 16.05.2012, 16:59
- Assembler optimisation - how to avoid a jump? - bretjohn, 16.05.2012, 16:42
- Assembler optimisation - how to avoid a jump? - Laaca, 14.05.2012, 18:15
- Assembler optimalisation - how to avoid a jump? - Rugxulo, 13.05.2012, 21:10
Mix view