2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-20 04:42:22 +00:00

6 Commits

Author SHA1 Message Date
Antony Polukhin
228922fdb5 Update copyright years 2026-01-04 11:26:11 +03:00
Antony Polukhin
3fe5ce61ee Update copyright years 2025-01-08 20:27:31 +03:00
Zachary Wassall
ff415a26ff Improve field count typical case performance (#120)
The tightest upper bound one can specify on the number of fields in a
struct is `sizeof(type) * CHAR_BIT`. So this was previously used when
performing a binary search for the field count. This upper bound is
extremely loose when considering a typical large struct, which is more
likely to contain a relatively small number of relatively large fields
rather than the other way around. The binary search range being multiple
orders of magnitude larger than necessary wouldn't have been a
significant issue if each test was cheap, but they're not. Testing a
field count of N costs O(N) memory and time. As a result, the initial
few steps of the binary search may be prohibitively expensive.

The primary optimization introduced by these changes is to use unbounded
binary search, a.k.a. exponential search, instead of the typically
loosely bounded binary search. This produces a tight upper bound (within
2x) on the field count to then perform the binary search with.

As an upside of this change, the compiler-specific limit placed on the
upper bound on the field count to stay within compiler limits could be
removed.
2024-10-09 14:12:39 +03:00
Antony Polukhin
16d771f498 Update copyright years 2024-01-07 13:12:44 +03:00
Antony Polukhin
551174b58c Update copyright years 2023-01-19 10:03:04 +03:00
denzor200
52a5a489ba split tests into two projects 2023-01-07 01:48:39 +06:00