Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Assembler optimisation - how to avoid a jump? (Developers)

posted by bretjohn Homepage E-mail, Rio Rancho, NM, 16.05.2012, 16:42

I'll just to add another two cents worth of opinion.

There are at least four general categories of things to keep in mind when writing code: speed, size, compatibility, and maintainability. To me, those are listed in reverse order of priority, though there is a constant balancing act.

The most important is maintainability, which at a minimum means lots of comments and "logical" organization of the code.

Compatibility with other programs and standards (even if de facto), even if it means a larger program size, is generally more important than the size.

Size matters A LOT, especially when you are dealing with DOS programs, and even more when you are dealing with TSR's. To me, this is not necessarily the size of the executable program file itself, but the amount of memory it ultimately requires.

Optimizing for speed is an almost endless chasing of your tail, and is not usually very productive. Something that is optimized for one particular manufacturer or model or stepping (or even cache size) of CPU doesn't mean it is optimized for every scenario, even if you avoid using any special CPU-specific instructions. You can do certain things in your code that can help the speed if the CPU uses pipelines (and that don't hurt performance if the CPU doesn't have pipelines), but even those can make the code more confusing (harder to understand) and therefore less maintainable. In most (but not all) situations, speed is a relatively minor concern. Even then, though, the speed issues don't usually involve specific CPU instructions, but more a "philosophy" of how to write the program (e.g., minimizing the number of switches between PM and V86/RM).

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum