Skip to content

Marginal DFASet improvement

DFASet-basetype.patch

type
	tdfaset = array of byte;

As you already have paid for a dynamic array that has at least three PtrInts at its header (two as a dynamic array and another one as a memory chunk), there is no reason to use byte as its base type (TDFASet is not serialized anywhere, isn’t it?).

The bad point about this change is that it has no effect on speed. But it shouldn’t hurt either.

Also, DFASet* functions sometimes end up not changing sets they work with. On my code this happens from 10% of the time for DFASetInclude to 30% for DFASetDiff to 90% for DFASetExcludeSet. The other time I tried to change them to support this fact and exploit reference counting more, delaying uniquifying of the array to the last, but again to zero effect and potentially breaking something (for some reason this has slightly changed the amount of times compiler called them :| maybe due to harmless things like DFASet(nil) vs. DFASet(0), but who knows...).

Still, one observation looks harmless and is included into this patch: DFASetNotEqual is often called (25% of the time!) with equal, non-nil pointers (and another 7.5% with two nils) when the negative answer can be given instantly.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information