[Oberon] Why is RSC string data word-aligned?

Jörg joerg.straube at iaeth.ch
Sun Jan 31 03:37:33 CET 2021


Hi Colby

> No.  To repeat: I'm talking about CPU instructions and memory reads--i.e.

Okay. So, what exactly do you want to optimize?
- write IO commands
- read IO commands
- memory accesses
- CPU cycles

All of the above is not equivalent. And might result in different code.
Normally, such kind of micro optimization is done in the inner most part of a loop that is called million of times. (ray tracing or so)
rsc file writing and reading does not happen very often.

>> To optimize the File IO you would turn this [...] into something like this
>I'm not sure where that sample comes from.  It doesn't match the code in the module loader (and it wouldn't make sense; the module loader is doing a file read, not a write).

This is the code in the compiler, where strings are written to the rsc file. And my attempt to optimize file write IO in the compiler, when writing the rsc file. My code does for sure less file write IO but is longer than the original. I can't immediately judge whether overall less CPU cycles are the result of my code compared to the original simple FOR. File write is buffered and is very efficient as it normally involves only two IFs and 3 assignments per Write() call.

The read in the module loader would obviously be the opposite: when reading the eos (=0X), we have to expand it to consecutive 0X to be word-aligned.

br
Jörg




More information about the Oberon mailing list