News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ASM for FUN - #1 SUB

Started by frktons, April 18, 2010, 08:52:38 PM

Previous topic - Next topic

frktons

Quote from: dedndave on April 20, 2010, 05:53:00 AM
Jochen's code is hard to read for n00bs like me   :P
he uses a lot of if/while structures that make it harder for me to understand
i prefer straight ASM - and indentation also makes it hard
i am an old dog and it's hard to learn new trix

I'm used to both of them, so for me it's easy enough to let me pay attention to things that I don't know yet.  :lol

Quote from: MichaelW on April 20, 2010, 08:27:34 AM
http://www.powerbasic.com/support/help/pbcc/tix_statement.htm

Hi Michael, thanks for the link.  :U
Mind is like a parachute. You know what to do in order to use it :-)

frktons

A final touch to the PEEK/POKE version, again
choosing REGISTER variables in a more appropriate way,
and the performance got a 40% improvement.

Old results:

At the moment we have these temporary results:

MID$ version ========> 12,665,435,382 CPU cycles
PEEK/POKE version  ====>       53,355,308 CPU cycles
MASM version  =======>          5,521,000 CPU cycles


New ones:

Using REGISTER variables in a better way:

MID$ version ========> 12,665,435,382 CPU cycles
PEEK/POKE version  ====>       31,865,067 CPU cycles
MASM version  =======>          5,521,000 CPU cycles


This means that just a bit of ASM in your mind gives you many
opportunities to write better CODE.  :P

Frank
Mind is like a parachute. You know what to do in order to use it :-)

hutch--

Its usually a good idea to enable register variables if you are not specifically writing asm code as you pick up the performance gain at no cost by doing so. From memory the internal compiler design uses ESI and EDI to perform variable replacements and within boundaries you get good gains in performance by using the default settings.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

frktons

Quote from: hutch-- on April 29, 2010, 02:32:40 PM
Its usually a good idea to enable register variables if you are not specifically writing asm code as you pick up the performance gain at no cost by doing so. From memory the internal compiler design uses ESI and EDI to perform variable replacements and within boundaries you get good gains in performance by using the default settings.

Yes Hutch. Using REGISTERs is a good way of speeding up performance in pure PB
CODE, and, in my experience, it is better to choose the ones that are probably used
more intensively. I was lucky, somehow, picking up the right variables that I imagined
were used a lot, and in two of the SUBs I could get an improvement from 30 to 50%.
Mind is like a parachute. You know what to do in order to use it :-)