home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,811 of 4,675   
   bart4858@nospicedham.gmail.com to Bart   
   Re: Fast conversion to a boolean of 0 or   
   08 Mar 19 15:47:30   
   
   On Friday, 8 March 2019 12:52:40 UTC, Bart  wrote:   
      
   > I wasn't able to compile your program using CL.EXE (didn't seem to   
   > recognise _asm).   
   >   
   > What I wanted to test was how long an empty for-loop would take. (I   
   > assume you would compile without optimisations to make sure it doesn't   
   > just get rid of such a loop.)   
   >   
   > Since I was curious as to how much of those 2 seconds is overheads.   
      
   I instead just typed in the asm examples using another language. It didn't   
   take long.   
      
   Tested on a cheap laptop (no idea what processor), loop overheads seemed to be   
   7/8 of total. Results I got were:   
      
      
   loop           : 1688  ms   
   cmov           : 234   
   sbb            : 218   
   jz             : 140   
   terje adc      : 328   
   james sbb+neg  : 218   
   setnz          : 219   
      
   The loop time is for an empty loop. The other timings are the extra runtimes   
   for each different method. Not it is easier to see that there was a more than   
   2:1 difference between slowest and fastest (on my machine and processor).   
      
   I've not kept up with the more recent updates and extra tests posted, and   
   actually I haven't looked at the code at all. (Although the SBB test looked a   
   little odd - the result is put into edi not eax?)   
      
   Anyway, my tests were adapted for 64-bit registers only.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca