🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2709

Re: TopSpeed and assembler

#2709
From: Peter P. Eiserloh
Date: Mon, 14 Aug 1995 22:54
41 lines
2441 bytes
In article <807534257.AA00868@puddle.fidonet.org> Marco van de Voort,
Marco.van.de.Voort@p18.f402.n284.z2.fidonet.org writes:
>Some things can't be done easily in Modula-2 (or TurboPascal or Basic)
>

In article <40bjb1$qgs@seagoon.newcastle.edu.au> Peter Moylan,
peter@fourier.newcastle.edu.au writes:
>I use assembly language myself in some situations - but only
>when I'm very sure that it's needed.
>

My simple examples are:
(1) Programming a Memory Management Unit, 
(2) Performing a context switch from one process to the 
next one on the ready queue, 
(3) Enabling/disabling/invoking interrupts.

These are obviously tasks perfomed by the operating system, 
but when the OS is written in any high level language such 
as Modula-2, you will still need access to specialized machine 
instructions.  

In article <40bjb1$qgs@seagoon.newcastle.edu.au> Peter Moylan,
peter@fourier.newcastle.edu.au writes:
>problem simply went away, and I ended up not using any assembly
>code at all.  If I had started thinking in terms of assembly
>language - or any other methods of fine-tuning the code - I
>would not have found the better algorithm.  By concentrating on
>a high-level view of the problem, I came up with a very major
>speed improvement rather than a small speed improvement.
>

I concur, only optimize a routine after a profiler has found
it to be the bottle-neck.  And the first step is to rethink the 
algorithm.  Only then optimize with assembly.  And when you do
rewrite the routine with assembly, leave the original M2 source
as comments.  Helps when porting from one machine to another, 
in additon to helping document what the routines purpose is.

Peter P. Eiserloh
-----------------
Technical Details
Message-ID: <DDBoyy.15H@avalon.chinalake.navy.mil>
Path: arc1-ca.pugleaf.net!rugeyes.chinalake.navy.mil!Peter_Eyes_Eiserloh
References: <807534257.AA00868@puddle.fidonet.org>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2
Path: arc1-ca.pugleaf.net!rugeyes.chinalake.navy.mil!Peter_Eyes_Eiserloh
From: Peter P. Eiserloh <Peter_Eyes_Eiserloh@cl_c21_smtp_gw.chinalake.navy.mil>
Subject: Re: TopSpeed and assembler
Content-Type: text/plain; charset=ISO-8859-1
Message-ID: <DDBoyy.15H@avalon.chinalake.navy.mil>
X-Xxmessage-Id: <AC5523576B014A08@rugeyes.chinalake.navy.mil>
X-Xxdate: Mon, 14 Aug 1995 22:59:19 GMT
Sender: usenet@avalon.chinalake.navy.mil (NAWS news admin)
Content-Transfer-Encoding: 8bit
Organization: Naval Air Warfare Center - Weapons Division
X-Newsreader: Nuntius 2.0.4_68K
References: <807534257.AA00868@puddle.fidonet.org>
Mime-Version: 1.0
Date: Mon, 14 Aug 1995 22:54:33 GMT