Specialized fpc_varset_create_element and fpc_varset_(un)set for i386 and x86_64.
These (No more after 12176d36.)fpc_varset_(un)set
are faster than current Include / Exclude
and after the recent change the benchmark has to make an effort to not get Include
for set += [a]
:D But this is a shortcoming of Include / Exclude
that hopefully will be addressed someday.
Specialized versions should be useful regardless. (Especially the day compiler learns to generate unset
...)
Benchmark (of System
functions): Set1Benchmark.pas.
My results:
x64 before after
StringToCharSet (varset_set): 563 ns/call 479 ns/call
StringToCharSet (include): 192 ns/call
StringToCharSets (varset_create_element): 852 ns/call 469 ns/call
i386 before after
StringToCharSet (varset_set): 800 ns/call 482 ns/call
StringToCharSet (include): 398 ns/call
StringToCharSets (varset_create_element): 0.9 us/call 781 ns/call
Edited by Rika