Hi folks,
Sometimes I'm reminded of the underlying limitations of old, compact, 68K Macs. I tried a little experiment with MacPascal 1.0 on an InfiniteMac emulation of a Mac 512Ke.

It's a simple program that just keeps allocating 1kB; reporting how many times it's done that and the elapsed time. I've attached the MacPascal disk image so you can play with it. The version on the .disk is a bit neater as it allows for 5 digits for the time (as a longint) and converts it to 0.1s units.
There's a couple of upshots from this program. Firstly, it doesn't exit properly, it just hangs at 359kB to 361kB. This means (512-361-22-(361*16/1024)) 123kB is being used by the system + MacPascal, under System 2.0. Perhaps Mac Pascal isn't allowing for a rainy-day memory fund.
The next thing to notice is how slow it gets. By 95kB, it's already taking 0.68s per allocation, but by the last allocation it's taken 2737.4s in total, on average that's about 7.6s per allocation! It gets really slow by then.
Some of this is probably because every block will be cleared, but that's relatively small compared with the allocation time. MacPascal's interpretive implementation won't actually contribute that much, because it's still going to operate at 1000s of lines per second. This leave heap allocation itself, though I'm surprised that even a linear scan through 361 memory blocks to find space would take so long. Perhaps MacPascal uses its own slow heap management - I'll have to compare it with NewPtr.
But the upshot is that you can't just fix 8MHz compact Mac issues with more RAM. Archaic heap allocation algorithms and sheer speed limitations of these old machines can limit what can be achieved using dynamic memory allocation.
Sometimes I'm reminded of the underlying limitations of old, compact, 68K Macs. I tried a little experiment with MacPascal 1.0 on an InfiniteMac emulation of a Mac 512Ke.

It's a simple program that just keeps allocating 1kB; reporting how many times it's done that and the elapsed time. I've attached the MacPascal disk image so you can play with it. The version on the .disk is a bit neater as it allows for 5 digits for the time (as a longint) and converts it to 0.1s units.
There's a couple of upshots from this program. Firstly, it doesn't exit properly, it just hangs at 359kB to 361kB. This means (512-361-22-(361*16/1024)) 123kB is being used by the system + MacPascal, under System 2.0. Perhaps Mac Pascal isn't allowing for a rainy-day memory fund.
The next thing to notice is how slow it gets. By 95kB, it's already taking 0.68s per allocation, but by the last allocation it's taken 2737.4s in total, on average that's about 7.6s per allocation! It gets really slow by then.
Some of this is probably because every block will be cleared, but that's relatively small compared with the allocation time. MacPascal's interpretive implementation won't actually contribute that much, because it's still going to operate at 1000s of lines per second. This leave heap allocation itself, though I'm surprised that even a linear scan through 361 memory blocks to find space would take so long. Perhaps MacPascal uses its own slow heap management - I'll have to compare it with NewPtr.
But the upshot is that you can't just fix 8MHz compact Mac issues with more RAM. Archaic heap allocation algorithms and sheer speed limitations of these old machines can limit what can be achieved using dynamic memory allocation.



