3 ms·
>The program itself was very, very, very shitty, but it worked well for him. For example, at that point I didn't even knew that arrays existed, so all the logic
by benibela 6y ago
>The program itself was very, very, very shitty, but it worked well for him. For example, at that point I didn't even knew that arrays existed, so all the logic and multiplication was done manually, like label43 = textInput25 * textInput24 * 0.1.
That is exactly how I wrote my Delphi code as kid!
Later, I learned to use arrays, and used them for everything because I did not know any other data structures. Like, array of array of array of integer. And the ref counting makes them memory safe. Delphi had the best arrays of all languages
At the university, they taught more complex data structures like linked lists and tree structures, so I started using them.
Then I learned about caches and that tree structures are bad for caches. Optimal are arrays. One should only use arrays for everything, so I started using arrays again.
Now I know about loop unrolling. And about the conservativity of the Pascal optimizer, it never keeps values in registers if they can alias. Heap values like arrays are always assumed to alias. If you do not use arrays, but use a separate local variable for every element, it can be much faster.