Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Aug 2021 00:03:45 +0200
From:      Joerg Sonnenberger <joerg@bec.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: sysctl is too slow
Message-ID:  <YRre/rbq2INNYchk@bec.de>
In-Reply-To: <CAGudoHGxWBLW2D6JX8mQCPwgM=ngt%2B3uZmwxK5p7yM6XeXXjsQ@mail.gmail.com>
References:  <CAOtMX2h7xkDM=GsPVyiWNcqxfRo7euZuuquSMn-y=PY5zRZNjg@mail.gmail.com> <CAGudoHGxWBLW2D6JX8mQCPwgM=ngt%2B3uZmwxK5p7yM6XeXXjsQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 16, 2021 at 09:30:51PM +0200, Mateusz Guzik wrote:
> Last time I checked lookup of a sysctl was very bad with linear scans all over.
> 
> Short of complete revamp of the entire thing I would start with
> replacing the scans with a RB tree at each level. As is if you indeed
> have 5000 datasets, you are doing increasingly longer walks.

The RB tree is what NetBSD is doing. The alternative that might be
simpler is to have a flag bit in the node "child nodes are sorted" and
lazily apply a sort whenever the node is scanned first, dropping the
flag when new children are attached or detached. That would allow a
binary search without extra memory cost?

Joerg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YRre/rbq2INNYchk>