Get the latest tech news

Assembly Optimization Tips by Mark Larson


ush ebx push esi push edi push ebp ; has to be done before changing ESP ;load up ESI and EDI and your other registers with the vales passed ;in on the stack. This has to be done before freeing up ESP.

Most compilers don't make good use of the string instructions ( scas, cmps, stos, movs, and lods). I wrote a program that you pass in the number you want to divide by, and it will print out the assembler code sequence. On the system I tested this on ( a Dell Server) with 6.4 GB/s of max memory bandwidth, I was able to do a read and a compare at 5.55 GB/s ( in a non-Windows environment.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of mark larson

mark larson