Re: [PATCH] qemu: Optimize monitor event name lookup with hash tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 21, 2024 at 17:36:48 +0530, Rayhan Faizel wrote:
> Currently, monitor event names are looked up using binary search which has
> O(log(n)) time complexity. This can be optimized even further with a
> compile-time static hash table generated by the gperf tool. As gperf ensures
> perfect hashing, lookup times are guaranteed to be O(1).

As a first point I'd like to ask if you are seeing any specific
performance problems with the existing code and ideally elaborate in
which cases.

This is a non-trivial change and with a justification in this commit
message I'm not really convinced that it's needed.

Unless QEMU would be firing a massive amount of events it is unlikely
that the lookup of the event will even have measurable impact.

It's also very likely that the lookup of the event handler is
overshadowed by the complexity of the actual handler, thus is the impact
even measurable?

> This patch also makes gperf a requirement for compiling libvirt if the QEMU
> driver is enabled.

Based on the above question I'm not persuaded that this is really
justified at this point.

Note that such change will also require update to the .spec. file
libvirt ships in the repo.

> 
> Signed-off-by: Rayhan Faizel <rayhan.faizel@xxxxxxxxx>
> ---
>  docs/kbase/internals/qemu-event-handlers.rst |  13 +-
>  meson.build                                  |   2 +
>  src/qemu/meson.build                         |   9 +
>  src/qemu/qemu_monitor_event.gperf            |  68 ++++++++
>  src/qemu/qemu_monitor_json.c                 | 171 +++++--------------
>  src/qemu/qemu_monitor_json.h                 |  45 +++++
>  6 files changed, 170 insertions(+), 138 deletions(-)
>  create mode 100644 src/qemu/qemu_monitor_event.gperf



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux