From: "Александр Шитов" <alex.shitov1237@gmail.com>
To: "libstdc++" <libstdc++@gcc.gnu.org>
Subject: __lower_bound improvement for arithmetical types(2)
Date: Mon, 17 Jul 2023 12:32:38 +0300 [thread overview]
Message-ID: <CAP=JgFptNgYOFia+9igUTJczFQv3wu0uucY4yqPHUDbevSiuXQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
A couple months ago I sent my proposal to add improvement for lower_bound.
As a reminder I send it once more
I want to propose an improvement to std::__lower_bound for arithmetic types
with the standard comparators.
The main idea is to use linear search on a small number of elements to aid
the branch predictor and CPU caches, but only when it is not observable by
the user. In other words, if a standard comparator (std::less,
std::greater) is used for arithmetic types.
In benchmarks I achieved twice the increase in speed for small vectors(16
elements) and increase for 10-20% in large vectors(1'000, 100'000 elements).
Code: https://gist.github.com/ATGsan/8a1fdec92371d5778a65b01321c43604
PR: https://github.com/ATGsan/gcc/pull/1
reply other threads:[~2023-07-17 9:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAP=JgFptNgYOFia+9igUTJczFQv3wu0uucY4yqPHUDbevSiuXQ@mail.gmail.com' \
--to=alex.shitov1237@gmail.com \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).