|
From: | Michael Tokarev |
Subject: | Re: qemu-user: avoid allocations to convert stuff when not necessary |
Date: | Mon, 10 Apr 2023 10:55:49 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 |
09.04.2023 19:27, Richard Henderson пишет:
On 4/9/23 01:52, Michael Tokarev wrote:Hi! In the qemu-user case, we allocate various structures and arrays for conversion of data between host and guest byte orders and sizes. But it is actually not necessary to do such allocation when the *size* is the same, and only byte order is different, because the conversion can be done in-place. Does it make any sense to avoid' allocations in such cases?Alignment can also change. This is especially visible with m68k guest, where even 'int' is 2-byte aligned.
I didn't think about the alignment. So such optimization has less and less chances to happen. I see.
So, no. It's best to just allocate and convert always.
Yes, this makes good sense. Thanks! /mjt
[Prev in Thread] | Current Thread | [Next in Thread] |