[fpc-pascal] Inclocked/declocked

Ryan Joseph ryan at thealchemistguild.com
Tue Sep 12 11:06:44 CEST 2017


> On Sep 12, 2017, at 12:56 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> The Inc-/DecLocked routines perform a locked increment/decrement, so they're blocking the memory bus for all cores (simply spoken), thus leading to a higher CPU utilization. On e.g. i386 there is an optimisation to only do that locking if IsMultiThread is True (some other platforms might benefit from that optimization as well :/ ).
> Additionally they are the leave routines of the dynamic array management code, so the time would be really used up there if not for the locking.

That’s probably it then even though I wasn’t growing the arrays by single elements (ReAllocMem didn’t give me problems). De facto Solution is to be safe and not use dynamic arrays in low-level high performance code.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list