[Top][All Lists]

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

Re: API pair_content() call is about 7x slower on Fedora 29 vs Bionic

From: Bryan Christ
Subject: Re: API pair_content() call is about 7x slower on Fedora 29 vs Bionic
Date: Sat, 29 Dec 2018 09:48:01 -0600

I realize the linear searches are not good but there's no easy way
around it.  Libvterm inits 64 color pairs (8 x 8) in keeping with the
64 colors allowed by the RXVT definition.  I do this because I have no
way of knowing how many / which colors some program running under the
emulator will need.  In the case of the demo program that gets built
with libvterm, I, as the implementer/integrator of the library, know how
to best look-up those color pairs and can therefore provide a better
callback.  I don't know that other users of the library will do the
same so it would be ideal if the performance could be at least as good
as on Bionic with the default linear lookup using pair_content().  

On Sat, Dec 29, 2018 at 5:45 AM Thomas Dickey <address@hidden> wrote:
On Fri, Dec 28, 2018 at 11:05:20AM -0600, Bryan Christ wrote:
> Thomas,
> Here's another callgrind log.  This one is from Bionic with the default
> callback
> installed (the wrapper for pair_content).  You can see that pair_content()
> does show
> up, but it's several times less impactful than the same scenario on F29.

thanks.  I see that you also checked in the code which calls pair_content,
and will make a benchmark to help with the discussion.  I can see some
area for improvement in ncurses (benchmark will show how much), but the
linear lookup of color pairs which you're doing is the main problem:

        a) if a pair is not initialized, you don't get much benefit from
           asking about it, since it has predefined (useless..) content.
        b) linear searches are _slow_, even for 512 elements.

Since your emulator captures all of the color information, it probably
would be better to limit the loop to the number of pairs actually
used, as well as to use tsearch to lookup the color information (using
your own cache).

I'll followup once I've done the benchmark/improvements.

Thomas E. Dickey <address@hidden>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]