spacejam / sled

the champagne of beta embedded databases
Apache License 2.0
7.89k stars 377 forks source link

Unsafe removal #1488

Open Wicpar opened 7 months ago

Wicpar commented 7 months ago

Removes unsafe implementations where in theory it should not affect perfoemance. I checked all implmenetations in compiler explorer, they give the equivalent code except for slice.fill() which is one zero check longer.

fastcmp is actually longer in assembly so i removed it as it contained unsafe too. the default cmp also calls the libc memcmp https://godbolt.org/z/83xTP74x1

Benchmarks are all over the place, so it's difficult to have a clear reading, it looks like a +-5% change in both ways with a slight bias for improvement. If someone else can benchmark and corroborate my findings it would be great.

My benchmarks were done on a raid0 nvme windows machine.

Related to #1487