[Tarantool-patches] [PATCH 2/2] uuid: fix unaligned memory access

Aleksandr Lyapunov alyapunov at tarantool.org
Tue May 19 10:28:33 MSK 2020


On 5/19/20 12:17 AM, Vladislav Shpilevoy wrote:
>
> Yeah, well. This is the same like saying that we degrade performance
> when we do OOM checks. Unaligned memory access is UB. This is a bug.
It's not the same. You could see I propose a solution that both violates no
rules and have the best performance. It's very far from just a complain.
>> I would suggest to use memcmp in this case.
>> It's portable and allows a compiler to generate the best possible code.
>> I've measured it (gcc) and memcmp version is twice faster than your solution.
>> Even for _is_nil method it's better to use memcmp with statically allocated zero buffer.
> Could you please show the benchmark? I did my own, and I can't see any
> significant difference. The present difference is so small, that it
> looks like jitter. Both in is_nil and is_eq.
>
> I did a very simple bench in Lua, without any GCed objects.
I fear that Lua is not suitable for performance tests.
Here you are: https://pastebin.com/VXkS1v6M
Also please take a look at disasm: https://godbolt.org/z/s6Cti4



More information about the Tarantool-patches mailing list