Quote:

> -- Does anyone if there is a program, that can convert Turbo Pascal 6.0

> code into assembler. I made a water engine completely with pascal code and

> it's s-l-o-w. I can't program in assembler, so information about program

> that

> can convert my code, would help me a lot.

> Mikko Kankaanp??

You have a program that converts TP into assembler: it is called

a compiler :)

Seriously, I doubt that it would help you much:

what makes assembler fast is all the shortcuts you can use at that

level (inline codes and that kind of things). What would be more

usefull as a first try is to see where your program spends its time,

using a profiler (BP7 has one, standalone), I don't know about TP6.

Then try and optimise the slowest parts by hand (in pascal). If that

doesn't speed up things enough, try and use your de{*filter*} to

look at the machine code generated and convert some bits of that

into assembler (inline) code (never done that yet myself).

A few hints about pascal optimisations:

- avoid divisions as much as possible, especially within a loop

- this goes even more with trigonometric functions and exp/log,

you can use lookup tables for sin/cos, depending on the precision

required. Also using 2 or 3 tables + addition/multiplication,

you can get high precision for sin/cos with a gain in speed

(e.g.: use one table for 1 degree precision, one for 0.01 degree

precision (_if needed_!), and use the proper formulas to add

the two together).

- get as much of the calculations outside loops (use extra

local vars if you have to). Moving half the calculation outside

the loop should almost double the speed (except for loop overhead).

- Write/Writeln is slow. Use with care:

prepare large blocks in memory for fast dumping with

blockwrite (e.g.). See if you cannot minimise output.

- Use math coprocessor with Single/Double/Extended, and _not_

with Real type: Real must be converted for each calculation using

the CPU, S/D/E are the native math processor types.

When no math coprocessor available, the inverse holds.

Hope this helps,

Remco

--

R.J. Vi?tor | AFE Chemistry

| University of Glasgow

The views expressed in this | Glasgow G12 8QQ

message represent only the | UK

personal views of the author |