1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Unicode **simple** case folding (schema spec ยง2), the single source of
//! truth for every case-insensitive comparison in this crate: sheet-name
//! uniqueness, named-range uniqueness, and case-insensitive sheet lookup
//! (plan item 3.1 sheet management).
//!
//! Pinned to Unicode *simple* `Case_Folding` (not `to_lowercase()` / full
//! folding, which disagree on some case pairs and would break cross-surface
//! determinism for names differing only in such characters).
use ;
use CaseMapperBorrowed;
/// How many times [`simple_fold`] has been called, process-wide.
static FOLD_CALLS: AtomicU64 = new;
/// How many bytes of input [`simple_fold`] has folded, process-wide.
static FOLD_BYTES: AtomicU64 = new;
/// Applies simple case folding to `s`, character by character.
/// How many folds this process has performed, and over how many input bytes.
///
/// Instrumentation, not a feature (same rationale as
/// [`AuthoredCellIndex::range_has_unauthored_cell_examined`](crate::AuthoredCellIndex::range_has_unauthored_cell_examined)):
/// a case fold allocates and walks its input, and "how many folds does one
/// recalc perform, and does that number depend on the cell count or the length
/// of the sheet names?" is the exact, machine-independent metric behind the
/// sheet-lookup work of issue #952. Wall clock is too machine-dependent to pin
/// in a test; the counters come out of the one function every fold in this
/// crate goes through, so they cannot drift from what actually ran.
///
/// The counters are process-wide and monotonic โ read them before and after
/// the operation under test and difference. Two tests in the same binary that
/// both read them cannot run concurrently; keep such assertions in a single
/// `#[test]`.
///
/// The byte count is a proxy for "does sheet-name length still multiply into
/// the per-cell cost": a fold's cost is linear in its input, so a per-cell
/// marginal byte count of zero is what makes name length stop mattering.