From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6296A469710 for ; Tue, 19 May 2020 10:28:35 +0300 (MSK) References: <172feb69ec2caea2aa63a24de8b76a4dba13bebb.1589583614.git.v.shpilevoy@tarantool.org> <52af1bb7-b125-7490-3882-ce74698789d2@tarantool.org> From: Aleksandr Lyapunov Message-ID: Date: Tue, 19 May 2020 10:28:33 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [Tarantool-patches] [PATCH 2/2] uuid: fix unaligned memory access List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, tsafin@tarantool.org, gorcunov@gmail.com 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