I am making a simple counter in assembly. It counts to a billion and exits. However, the performance of this is really horrible. A Java application (that does the same) outperforms it by around 10x. How can I optimize this code?
include 'include/win32ax.inc' section '.data' Data readable writeable outhandle DD ? inhandle DD ? incr DD 0 numwritten DD ? inchar DB ? numread DD ? section '.text' code readable executable start: invoke AllocConsole invoke GetStdHandle,STD_OUTPUT_HANDLE mov [outhandle],eax invoke GetStdHandle,STD_INPUT_HANDLE mov [inhandle],eax invoke WriteConsole,[outhandle],"Starting...",11,numwritten,0 jmp loopcount loopcount: inc [incr] cmp [incr], 1000000000;1 billion. ;] jne loopcount invoke WriteConsole,[outhandle]," Done count",13,numwritten,0 invoke ReadConsole,[inhandle],inchar,2,numread,0 invoke ExitProcess,0 .end start