Commit Graph
2153 Commits
Author SHA1 Message Date
6c812db05c Clarify name bindings in namespaces. (#3407)
-   Require namespace members be declared in the same name scope as the
    namespace is declared.
-   Allow binding patterns to directly declare names in namespaces.
-   Disallow using different namespaces in the same binding pattern.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-11-22 22:52:08 +00:00
Geoff Romer af9b323aad Rephrase to clarify paren expression terminology (#3417)
Avoids the confusion of saying that an expression that's parenthesized
isn't necessarily a "parenthesized expression".
2023-11-22 22:44:54 +00:00
Jon Ross-Perkins 5522e4f613 Switch cross references to a ValueStore. (#3414)
As I get ready to add imports, I need an API to add values and this
offers a consistent way of doing so.
2023-11-22 21:43:17 +00:00
Richard SmithandChandler Carruth 9154c6410e Support for reading source code from stdin and other unusual places. (#3416)
- Treat an input of `-` as meaning stdin.

- Fix building of an llvm::MemoryBuffer from a non-regular file.

- Do not enforce filename restrictions on non-regular files.

- Do not invent an output file name based on the name of a non-regular
file.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-11-22 03:48:10 +00:00
Jon Ross-Perkins a204689893 Use more specific node kinds for literals. (#3419)
Sounding out the approach, to make it clearer what a literal node
corresponds to.
2023-11-22 01:27:28 +00:00
f1ddded3a1 [explorer] Add support for abstract virtual methods (#3411)
Completing the work from #2761 by adding additional test cases. 
Closes #2512

---------

Co-authored-by: Maan2003 <manmeetmann2003@gmail.com>
Co-authored-by: Aleksei Ermakov <alexey@emkv.me>
2023-11-21 01:32:00 +00:00
Jon Ross-Perkins 9d369db8ea Diagnose incorrect file extensions. (#3409)
Note this is building on #3408
2023-11-20 23:49:10 +00:00
kshokhin b6d660b4d9 Add nested array size deduction from tuple (#2909)
As a follow up to #2825 this pr implements size deduction for nested
arrays.
E.g. `var x: [[i32;];] = ((1,2), (3,4));`.

Also updated the pattern matching logic for arrays, now it also checks
element types of the tuple size being deduced from. As a result code
like `var x: [i32;] = ("foo", "bar");`(note, that it tries to init an
array of i32 with a tuple of strings) fails to compile with a pattern
match error instead of an implicit cast failed error.

Moved some common type-related logic used in type_checker.cpp and
interpreter.cpp to the separate file.
2023-11-20 20:20:21 +00:00
f59a6cdbdd Introduce a Carbon hashing framework. (#3327)
# Overview

This is a latency-optimized hashing framework based on Abseil's and
others. At it's core it uses both a normal 64-bit multiply as well as a
64-bit multiply capturing both low and high 64-bit components of the
result and XOR-ing them together. These are the primitives used in
FxHash and Abseil respectively, although they both appear in others.

The implementation has been *substantially* optimized for short inputs
and latency over quality. As a result, this function does not remotely
pass the SMHasher quality tests. However, basic collisions are rare, and
I've included a small subset of the SMHasher collision testing directly
to make sure the quality doesn't slip too far inadvertently.

The customization framework is roughly similar to Abseil's and LLVM's
but has been simplified significantly, inspired in some respects by the
AHash API design and in others by my experience of all performance
sensitive hashing implementations needing to work at a very low level to
hit their performance targets. The abstractions are stripped down to
facilitate this.

# Details of the performance optimization

This function is 2x - 4x faster than LLVM's on small inputs, and up to
2x faster than Abseil. Significant effort has gone into optimizing short
strings in particular compared to Abseil.

Small integer and pointer hashing is also faster than Abseil's by
leveraging a lower quality 64-bit multiply in some cases inspired by
FxHash. One consequence is that this routine is particulary fast for
32-bit integers.

The short string improvements largely come from packing more of the
bytes of string into as few multiplies as possible. While this fails to
mix the bits sufficient to hit SMHasher's strict avalanche criteria and
does leave some collision windows, it provides dramatic latency
improvements. Some of these techniques come from Abseil's own bulk
hashing routine but re-applied here. Others are novel, for example using
small sizes to sample nicely uniform random data to efficiently handle
the very small number of bits of data that need to be hashed.

The other observed improvement is diligent handling of pairs and tuples
and fairly aggressively turning things into integers. Some of the
comparisons with Abseil aren't realistic as the Abseil hash table does
some of these mappings before hashing. I've done this directly in the
hash function as that seems cleaner.

For long strings, the performance is comparable or a bit better than
Abseil, and significantly better than LLVM's hash function.

Overall, for short inputs this is hoped to be the fastest hash function
that still gets "just enough" mixing for modern hash tables to perform
well.

# Details of the quality vs. latency tradeoff

A key insight is that modern hash tables don't need especially high
quality hash functions, but do benefit from something beyond the
identify function. That isn't the target of SMHasher or other quality
assessing tools and has resulted in unnecessarily aggressive hashing for
any functions actually evaluated against it. Many hash functions turn
off the high quality implementations evaluated with SMHasher for integer
or pointer keys to recover latency & performance (AHash for example),
but the same performance-oriented design applies beyond these narrow
types, for example for short strings.

However, a consequence is that there are serious limits to the quality
of the hash function. The avalanche test is failed hilariously, etc.,
but in the exact same ways as Abseil itself fails it for integer keys.
There are also real collisions spaces. For example, for 16-byte strings,
there is one 64-bit value for the first 8 bytes that will have the same
hash regardless of the other 8 bytes of the string. Some minor effort is
taken to make this pattern unlikely to be a practical problem, but it is
a clear theoretical weakness.

It also means that this hash function couldn't be further from providing
any hash-flooding DoS attack protection -- I expect it to be trivially
easy to attack in this way by a motivated adversary. Defending against
these attacks is defined as out-of-scope, in large part because even
attempts that have made a compelling effort to address these issues such
as HighwayHash have found serious limits. Instead, this takes a
principled position that any such defense should be provided entirely at
the data structure level with a strong worst-case bound rather than
through strengthening the hash function.

# Future work

A subsequent PR will introduce a hash table inspired very heavily by the
design of Abseil's "SwissTable" and using this hash function. The goal
is to provide a significant improvement to hot hash tables such as the
identifier table in the lexer of Carbon's toolchain.

# Detailed benchmark data

The benchmarks introduced are heavily inspired by the latency
benchmarking of hash functions in Abseil. I've adapted them to fit
better into Carbon's coding style and to try to have more stable results
with broader coverage of types and string sizes.

Running the benchmarks directly gives horizontal comparisons across
different hash functions. That can be hard to read, so here is *just*
the newly introduced hash function benchmark results on an AMD server:

```
BM_LatencyHash<RandValues<uint8_t>, CarbonHashBench>                          3.11ns ± 1%
BM_LatencyHash<RandValues<uint16_t>, CarbonHashBench>                         3.11ns ± 1%
BM_LatencyHash<RandValues<std::pair<uint8_t, uint8_t>>, CarbonHashBench>      4.11ns ± 1%
BM_LatencyHash<RandValues<uint32_t>, CarbonHashBench>                         3.12ns ± 1%
BM_LatencyHash<RandValues<std::pair<uint16_t, uint16_t>>, CarbonHashBench>    4.13ns ± 1%
BM_LatencyHash<RandValues<uint64_t>, CarbonHashBench>                         3.16ns ± 2%
BM_LatencyHash<RandValues<int*>, CarbonHashBench>                             3.16ns ± 2%
BM_LatencyHash<RandValues<std::pair<uint32_t, uint32_t>>, CarbonHashBench>    4.03ns ± 2%
BM_LatencyHash<RandValues<std::pair<uint64_t, uint32_t>>, CarbonHashBench>    4.04ns ± 1%
BM_LatencyHash<RandValues<std::pair<uint32_t, uint64_t>>, CarbonHashBench>    4.34ns ± 2%
BM_LatencyHash<RandValues<std::pair<int*, uint32_t>>, CarbonHashBench>        4.04ns ± 1%
BM_LatencyHash<RandValues<std::pair<uint32_t, int*>>, CarbonHashBench>        4.34ns ± 2%
BM_LatencyHash<RandValues<__uint128_t>, CarbonHashBench>                      4.33ns ± 1%
BM_LatencyHash<RandValues<std::pair<uint64_t, uint64_t>>, CarbonHashBench>    4.33ns ± 1%
BM_LatencyHash<RandValues<std::pair<int*, int*>>, CarbonHashBench>            4.34ns ± 1%
BM_LatencyHash<RandValues<std::pair<uint64_t, int*>>, CarbonHashBench>        4.33ns ± 1%
BM_LatencyHash<RandValues<std::pair<int*, uint64_t>>, CarbonHashBench>        4.33ns ± 1%
BM_LatencyHash<RandStrings< true, 4>, CarbonHashBench>                        1.95ns ± 4%
BM_LatencyHash<RandStrings< true, 8>, CarbonHashBench>                        1.70ns ± 3%
BM_LatencyHash<RandStrings< true, 16>, CarbonHashBench>                       3.52ns ± 3%
BM_LatencyHash<RandStrings< true, 32>, CarbonHashBench>                       4.46ns ± 2%
BM_LatencyHash<RandStrings< true, 64>, CarbonHashBench>                       7.69ns ± 1%
BM_LatencyHash<RandStrings< true, 256>, CarbonHashBench>                      14.8ns ± 1%
BM_LatencyHash<RandStrings< true, 512>, CarbonHashBench>                      21.5ns ± 1%
BM_LatencyHash<RandStrings< true, 1024>, CarbonHashBench>                     34.6ns ± 0%
BM_LatencyHash<RandStrings< true, 2048>, CarbonHashBench>                     63.1ns ± 1%
BM_LatencyHash<RandStrings< true, 4096>, CarbonHashBench>                      118ns ± 1%
BM_LatencyHash<RandStrings< true, 8192>, CarbonHashBench>                      225ns ± 1%
```

And on an ARM server:

```
BM_LatencyHash<RandValues<uint8_t>, CarbonHashBench>                          5.28ns ± 0%
BM_LatencyHash<RandValues<uint16_t>, CarbonHashBench>                         5.29ns ± 0%
BM_LatencyHash<RandValues<std::pair<uint8_t, uint8_t>>, CarbonHashBench>      7.02ns ± 0%
BM_LatencyHash<RandValues<uint32_t>, CarbonHashBench>                         5.34ns ± 1%
BM_LatencyHash<RandValues<std::pair<uint16_t, uint16_t>>, CarbonHashBench>    7.07ns ± 4%
BM_LatencyHash<RandValues<uint64_t>, CarbonHashBench>                         5.36ns ± 2%
BM_LatencyHash<RandValues<int*>, CarbonHashBench>                             5.36ns ± 2%
BM_LatencyHash<RandValues<std::pair<uint32_t, uint32_t>>, CarbonHashBench>    7.19ns ± 3%
BM_LatencyHash<RandValues<std::pair<uint64_t, uint32_t>>, CarbonHashBench>    7.29ns ± 2%
BM_LatencyHash<RandValues<std::pair<uint32_t, uint64_t>>, CarbonHashBench>    7.31ns ± 4%
BM_LatencyHash<RandValues<std::pair<int*, uint32_t>>, CarbonHashBench>        7.29ns ± 2%
BM_LatencyHash<RandValues<std::pair<uint32_t, int*>>, CarbonHashBench>        7.31ns ± 4%
BM_LatencyHash<RandValues<__uint128_t>, CarbonHashBench>                      8.69ns ± 3%
BM_LatencyHash<RandValues<std::pair<uint64_t, uint64_t>>, CarbonHashBench>    8.69ns ± 3%
BM_LatencyHash<RandValues<std::pair<int*, int*>>, CarbonHashBench>            8.69ns ± 3%
BM_LatencyHash<RandValues<std::pair<uint64_t, int*>>, CarbonHashBench>        8.69ns ± 3%
BM_LatencyHash<RandValues<std::pair<int*, uint64_t>>, CarbonHashBench>        8.69ns ± 3%
BM_LatencyHash<RandStrings< true, 4>, CarbonHashBench>                        2.64ns ± 2%
BM_LatencyHash<RandStrings< true, 8>, CarbonHashBench>                        2.90ns ± 4%
BM_LatencyHash<RandStrings< true, 16>, CarbonHashBench>                       6.14ns ± 1%
BM_LatencyHash<RandStrings< true, 32>, CarbonHashBench>                       8.27ns ± 1%
BM_LatencyHash<RandStrings< true, 64>, CarbonHashBench>                       13.8ns ± 0%
BM_LatencyHash<RandStrings< true, 256>, CarbonHashBench>                      31.2ns ± 0%
BM_LatencyHash<RandStrings< true, 512>, CarbonHashBench>                      49.9ns ± 0%
BM_LatencyHash<RandStrings< true, 1024>, CarbonHashBench>                     86.9ns ± 0%
BM_LatencyHash<RandStrings< true, 2048>, CarbonHashBench>                      163ns ± 0%
BM_LatencyHash<RandStrings< true, 4096>, CarbonHashBench>                      312ns ± 0%
BM_LatencyHash<RandStrings< true, 8192>, CarbonHashBench>                      610ns ± 0%
```

I don't have the same nice statistical multi-run error bars, but one run
from my M1 MacBook:

```
BM_LatencyHash<RandValues<uint8_t>, CarbonHashBench>                             3.89 ns
BM_LatencyHash<RandValues<uint16_t>, CarbonHashBench>                            3.87 ns
BM_LatencyHash<RandValues<std::pair<uint8_t, uint8_t>>, CarbonHashBench>         4.39 ns
BM_LatencyHash<RandValues<uint32_t>, CarbonHashBench>                            3.93 ns
BM_LatencyHash<RandValues<std::pair<uint16_t, uint16_t>>, CarbonHashBench>       4.98 ns
BM_LatencyHash<RandValues<uint64_t>, CarbonHashBench>                            3.87 ns
BM_LatencyHash<RandValues<int*>, CarbonHashBench>                                3.87 ns
BM_LatencyHash<RandValues<std::pair<uint32_t, uint32_t>>, CarbonHashBench>       4.86 ns
BM_LatencyHash<RandValues<std::pair<uint64_t, uint32_t>>, CarbonHashBench>       4.43 ns
BM_LatencyHash<RandValues<std::pair<uint32_t, uint64_t>>, CarbonHashBench>       4.41 ns
BM_LatencyHash<RandValues<std::pair<int*, uint32_t>>, CarbonHashBench>           4.44 ns
BM_LatencyHash<RandValues<std::pair<uint32_t, int*>>, CarbonHashBench>           4.69 ns
BM_LatencyHash<RandValues<__uint128_t>, CarbonHashBench>                         4.33 ns
BM_LatencyHash<RandValues<std::pair<uint64_t, uint64_t>>, CarbonHashBench>       4.38 ns
BM_LatencyHash<RandValues<std::pair<int*, int*>>, CarbonHashBench>               4.34 ns
BM_LatencyHash<RandValues<std::pair<uint64_t, int*>>, CarbonHashBench>           4.35 ns
BM_LatencyHash<RandValues<std::pair<int*, uint64_t>>, CarbonHashBench>           4.38 ns
BM_LatencyHash<RandStrings< true, 4>, CarbonHashBench>                           1.15 ns
BM_LatencyHash<RandStrings< true, 8>, CarbonHashBench>                          0.973 ns
BM_LatencyHash<RandStrings< true, 16>, CarbonHashBench>                          3.03 ns
BM_LatencyHash<RandStrings< true, 32>, CarbonHashBench>                          3.97 ns
BM_LatencyHash<RandStrings< true, 64>, CarbonHashBench>                          6.64 ns
BM_LatencyHash<RandStrings< true, 256>, CarbonHashBench>                         12.5 ns
BM_LatencyHash<RandStrings< true, 512>, CarbonHashBench>                         17.9 ns
BM_LatencyHash<RandStrings< true, 1024>, CarbonHashBench>                        27.9 ns
BM_LatencyHash<RandStrings< true, 2048>, CarbonHashBench>                        48.1 ns
BM_LatencyHash<RandStrings< true, 4096>, CarbonHashBench>                        87.3 ns
BM_LatencyHash<RandStrings< true, 8192>, CarbonHashBench>                         166 ns
```

And here I have internally replaced the Carbon hash function with
Abseil's hash function for "before" and then restored it in the "after"
and computed the delta for each benchmark. This basically shows the
speed-up (lower time -> lower latency -> speed-up -> good) over Abseil
on an AMD server:

```
BM_LatencyHash<RandValues<uint8_t>, CarbonHashBench>                          4.00ns ± 1%  3.10ns ± 0%  -22.45%  (p=0.000 n=20+15)
BM_LatencyHash<RandValues<uint16_t>, CarbonHashBench>                         4.01ns ± 1%  3.10ns ± 1%  -22.64%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint8_t, uint8_t>>, CarbonHashBench>      6.25ns ± 1%  4.10ns ± 1%  -34.30%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<uint32_t>, CarbonHashBench>                         4.02ns ± 1%  3.12ns ± 1%  -22.50%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<std::pair<uint16_t, uint16_t>>, CarbonHashBench>    6.25ns ± 1%  4.11ns ± 1%  -34.20%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<uint64_t>, CarbonHashBench>                         4.03ns ± 1%  3.14ns ± 1%  -22.17%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<int*>, CarbonHashBench>                             5.95ns ± 1%  3.14ns ± 1%  -47.24%  (p=0.000 n=20+18)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint32_t>>, CarbonHashBench>    6.04ns ± 1%  4.01ns ± 1%  -33.64%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint32_t>>, CarbonHashBench>    5.96ns ± 1%  4.02ns ± 1%  -32.51%  (p=0.000 n=18+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint64_t>>, CarbonHashBench>    5.93ns ± 1%  4.30ns ± 1%  -27.56%  (p=0.000 n=20+17)
BM_LatencyHash<RandValues<std::pair<int*, uint32_t>>, CarbonHashBench>        7.97ns ± 1%  4.02ns ± 1%  -49.50%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, int*>>, CarbonHashBench>        7.98ns ± 1%  4.32ns ± 1%  -45.88%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<__uint128_t>, CarbonHashBench>                      4.40ns ± 2%  4.32ns ± 1%   -1.81%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint64_t>>, CarbonHashBench>    5.94ns ± 1%  4.32ns ± 1%  -27.25%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<int*, int*>>, CarbonHashBench>            10.0ns ± 1%   4.3ns ± 1%  -56.56%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, int*>>, CarbonHashBench>        8.04ns ± 1%  4.32ns ± 1%  -46.29%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<std::pair<int*, uint64_t>>, CarbonHashBench>        7.95ns ± 1%  4.33ns ± 1%  -45.59%  (p=0.000 n=19+20)
BM_LatencyHash<RandStrings< true, 4>, CarbonHashBench>                        3.28ns ± 3%  1.93ns ± 4%  -41.19%  (p=0.000 n=18+20)
BM_LatencyHash<RandStrings< true, 8>, CarbonHashBench>                        3.05ns ± 3%  1.69ns ± 4%  -44.52%  (p=0.000 n=19+20)
BM_LatencyHash<RandStrings< true, 16>, CarbonHashBench>                       5.88ns ± 2%  3.50ns ± 3%  -40.42%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 32>, CarbonHashBench>                       8.92ns ± 1%  4.44ns ± 2%  -50.22%  (p=0.000 n=19+20)
BM_LatencyHash<RandStrings< true, 64>, CarbonHashBench>                       12.0ns ± 1%   7.7ns ± 1%  -36.16%  (p=0.000 n=18+20)
BM_LatencyHash<RandStrings< true, 256>, CarbonHashBench>                      18.8ns ± 0%  14.7ns ± 1%  -21.73%  (p=0.000 n=17+20)
BM_LatencyHash<RandStrings< true, 512>, CarbonHashBench>                      25.5ns ± 1%  21.4ns ± 1%  -16.18%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 1024>, CarbonHashBench>                     38.7ns ± 2%  34.5ns ± 1%  -10.78%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 2048>, CarbonHashBench>                     69.7ns ± 1%  62.8ns ± 1%   -9.88%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 4096>, CarbonHashBench>                      130ns ± 1%   117ns ± 1%   -9.45%  (p=0.000 n=20+19)
BM_LatencyHash<RandStrings< true, 8192>, CarbonHashBench>                      244ns ± 0%   225ns ± 1%   -8.11%  (p=0.000 n=17+20)
```

... and on an ARM server:

```
BM_LatencyHash<RandValues<uint8_t>, CarbonHashBench>                          6.48ns ± 1%  5.28ns ± 0%  -18.62%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<uint16_t>, CarbonHashBench>                         7.40ns ± 1%  5.29ns ± 1%  -28.45%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint8_t, uint8_t>>, CarbonHashBench>      10.4ns ± 0%   7.0ns ± 0%  -32.34%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<uint32_t>, CarbonHashBench>                         6.56ns ± 1%  5.32ns ± 1%  -18.95%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<std::pair<uint16_t, uint16_t>>, CarbonHashBench>    10.8ns ± 2%   7.0ns ± 1%  -34.89%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<uint64_t>, CarbonHashBench>                         6.71ns ± 3%  5.38ns ± 2%  -19.84%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<int*>, CarbonHashBench>                             10.3ns ± 3%   5.4ns ± 2%  -47.67%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint32_t>>, CarbonHashBench>    10.9ns ± 2%   7.2ns ± 4%  -33.67%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint32_t>>, CarbonHashBench>    10.7ns ± 4%   7.3ns ± 4%  -31.66%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint64_t>>, CarbonHashBench>    10.5ns ± 3%   7.3ns ± 4%  -30.71%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<std::pair<int*, uint32_t>>, CarbonHashBench>        14.1ns ± 3%   7.3ns ± 4%  -48.32%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, int*>>, CarbonHashBench>        14.0ns ± 1%   7.3ns ± 4%  -47.95%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<__uint128_t>, CarbonHashBench>                      9.41ns ± 4%  8.68ns ± 4%   -7.71%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint64_t>>, CarbonHashBench>    12.2ns ± 2%   8.7ns ± 4%  -28.81%  (p=0.000 n=18+19)
BM_LatencyHash<RandValues<std::pair<int*, int*>>, CarbonHashBench>            18.9ns ± 2%   8.7ns ± 4%  -54.17%  (p=0.000 n=17+19)
BM_LatencyHash<RandValues<std::pair<uint64_t, int*>>, CarbonHashBench>        15.6ns ± 2%   8.7ns ± 4%  -44.37%  (p=0.000 n=17+19)
BM_LatencyHash<RandValues<std::pair<int*, uint64_t>>, CarbonHashBench>        15.5ns ± 2%   8.7ns ± 4%  -44.08%  (p=0.000 n=18+19)
BM_LatencyHash<RandStrings< true, 4>, CarbonHashBench>                        5.89ns ± 2%  2.64ns ± 3%  -55.26%  (p=0.000 n=19+20)
BM_LatencyHash<RandStrings< true, 8>, CarbonHashBench>                        5.73ns ± 3%  2.88ns ± 3%  -49.71%  (p=0.000 n=18+20)
BM_LatencyHash<RandStrings< true, 16>, CarbonHashBench>                       10.1ns ± 1%   6.1ns ± 2%  -39.00%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 32>, CarbonHashBench>                       15.7ns ± 0%   8.3ns ± 1%  -47.27%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 64>, CarbonHashBench>                       21.2ns ± 0%  13.8ns ± 0%  -34.81%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 256>, CarbonHashBench>                      37.9ns ± 0%  31.2ns ± 0%  -17.77%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 512>, CarbonHashBench>                      56.8ns ± 0%  49.8ns ± 0%  -12.21%  (p=0.000 n=20+18)
BM_LatencyHash<RandStrings< true, 1024>, CarbonHashBench>                     93.8ns ± 0%  86.9ns ± 0%   -7.38%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 2048>, CarbonHashBench>                      174ns ± 0%   163ns ± 0%   -6.03%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 4096>, CarbonHashBench>                      330ns ± 0%   312ns ± 0%   -5.25%  (p=0.000 n=19+20)
BM_LatencyHash<RandStrings< true, 8192>, CarbonHashBench>                      641ns ± 0%   610ns ± 0%   -4.79%  (p=0.000 n=19+19)
```

This is the same as the above delta comparison, but with the "before"
being LLVM's hash function:

```
BM_LatencyHash<RandValues<uint8_t>, CarbonHashBench>                          6.85ns ± 1%  3.10ns ± 1%  -54.78%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<uint16_t>, CarbonHashBench>                         6.85ns ± 1%  3.10ns ± 1%  -54.78%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<std::pair<uint8_t, uint8_t>>, CarbonHashBench>      6.25ns ± 1%  4.09ns ± 1%  -34.58%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<uint32_t>, CarbonHashBench>                         6.87ns ± 1%  3.12ns ± 2%  -54.66%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint16_t, uint16_t>>, CarbonHashBench>    7.35ns ± 1%  4.10ns ± 1%  -44.20%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<uint64_t>, CarbonHashBench>                         7.34ns ± 1%  3.13ns ± 1%  -57.34%  (p=0.000 n=20+18)
BM_LatencyHash<RandValues<int*>, CarbonHashBench>                             7.33ns ± 1%  3.13ns ± 2%  -57.27%  (p=0.000 n=20+18)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint32_t>>, CarbonHashBench>    7.27ns ± 1%  3.99ns ± 1%  -45.12%  (p=0.000 n=20+18)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint32_t>>, CarbonHashBench>    14.5ns ± 1%   4.0ns ± 1%  -72.23%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint64_t>>, CarbonHashBench>    14.6ns ± 1%   4.3ns ± 2%  -70.44%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<int*, uint32_t>>, CarbonHashBench>        14.5ns ± 1%   4.0ns ± 1%  -72.21%  (p=0.000 n=20+19)
BM_LatencyHash<RandValues<std::pair<uint32_t, int*>>, CarbonHashBench>        14.6ns ± 1%   4.3ns ± 1%  -70.46%  (p=0.000 n=20+18)
BM_LatencyHash<RandValues<__uint128_t>, CarbonHashBench>                      7.31ns ± 1%  4.33ns ± 1%  -40.81%  (p=0.000 n=18+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint64_t>>, CarbonHashBench>    7.78ns ± 1%  4.32ns ± 1%  -44.45%  (p=0.000 n=18+20)
BM_LatencyHash<RandValues<std::pair<int*, int*>>, CarbonHashBench>            7.78ns ± 2%  4.33ns ± 1%  -44.42%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, int*>>, CarbonHashBench>        7.62ns ± 1%  4.32ns ± 1%  -43.24%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<int*, uint64_t>>, CarbonHashBench>        7.77ns ± 1%  4.33ns ± 1%  -44.34%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 4>, CarbonHashBench>                        8.15ns ± 3%  1.94ns ± 5%  -76.16%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 8>, CarbonHashBench>                        7.02ns ± 3%  1.69ns ± 4%  -75.94%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 16>, CarbonHashBench>                       7.83ns ± 2%  3.50ns ± 3%  -55.34%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 32>, CarbonHashBench>                       9.17ns ± 1%  4.43ns ± 2%  -51.65%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 64>, CarbonHashBench>                       11.3ns ± 1%   7.6ns ± 1%  -32.04%  (p=0.000 n=20+19)
BM_LatencyHash<RandStrings< true, 256>, CarbonHashBench>                      23.0ns ± 1%  14.7ns ± 1%  -36.14%  (p=0.000 n=20+19)
BM_LatencyHash<RandStrings< true, 512>, CarbonHashBench>                      32.9ns ± 0%  21.4ns ± 1%  -34.96%  (p=0.000 n=17+19)
BM_LatencyHash<RandStrings< true, 1024>, CarbonHashBench>                     52.2ns ± 1%  34.4ns ± 1%  -34.01%  (p=0.000 n=19+18)
BM_LatencyHash<RandStrings< true, 2048>, CarbonHashBench>                     92.1ns ± 1%  62.8ns ± 1%  -31.82%  (p=0.000 n=19+19)
BM_LatencyHash<RandStrings< true, 4096>, CarbonHashBench>                      169ns ± 1%   117ns ± 1%  -30.53%  (p=0.000 n=20+19)
BM_LatencyHash<RandStrings< true, 8192>, CarbonHashBench>                      319ns ± 1%   224ns ± 1%  -29.78%  (p=0.000 n=20+18)
```

... and on an ARM server:

```
BM_LatencyHash<RandValues<uint8_t>, CarbonHashBench>                          8.38ns ± 0%  5.27ns ± 0%  -37.04%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<uint16_t>, CarbonHashBench>                         8.39ns ± 1%  5.28ns ± 0%  -37.01%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<std::pair<uint8_t, uint8_t>>, CarbonHashBench>      8.07ns ± 0%  7.02ns ± 0%  -13.10%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<uint32_t>, CarbonHashBench>                         8.48ns ± 1%  5.32ns ± 1%  -37.25%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint16_t, uint16_t>>, CarbonHashBench>    9.34ns ± 2%  7.09ns ± 2%  -24.14%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<uint64_t>, CarbonHashBench>                         9.76ns ± 3%  5.37ns ± 2%  -44.98%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<int*>, CarbonHashBench>                             9.76ns ± 3%  5.37ns ± 2%  -44.98%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint32_t>>, CarbonHashBench>    10.1ns ± 2%   7.2ns ± 3%  -29.36%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint32_t>>, CarbonHashBench>    11.9ns ± 2%   7.3ns ± 4%  -38.68%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, uint64_t>>, CarbonHashBench>    11.3ns ± 2%   7.3ns ± 4%  -35.16%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<std::pair<int*, uint32_t>>, CarbonHashBench>        11.9ns ± 2%   7.3ns ± 4%  -38.68%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint32_t, int*>>, CarbonHashBench>        11.3ns ± 2%   7.3ns ± 4%  -35.16%  (p=0.000 n=19+19)
BM_LatencyHash<RandValues<__uint128_t>, CarbonHashBench>                      10.3ns ± 2%   8.7ns ± 3%  -15.81%  (p=0.000 n=19+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, uint64_t>>, CarbonHashBench>    11.6ns ± 3%   8.7ns ± 3%  -25.44%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<int*, int*>>, CarbonHashBench>            11.6ns ± 3%   8.7ns ± 3%  -25.44%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<uint64_t, int*>>, CarbonHashBench>        11.6ns ± 3%   8.7ns ± 3%  -25.44%  (p=0.000 n=20+20)
BM_LatencyHash<RandValues<std::pair<int*, uint64_t>>, CarbonHashBench>        11.6ns ± 3%   8.7ns ± 3%  -25.44%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 4>, CarbonHashBench>                        9.39ns ± 2%  2.66ns ± 3%  -71.66%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 8>, CarbonHashBench>                        10.7ns ± 3%   2.9ns ± 3%  -72.97%  (p=0.000 n=19+18)
BM_LatencyHash<RandStrings< true, 16>, CarbonHashBench>                       11.8ns ± 1%   6.1ns ± 2%  -47.75%  (p=0.000 n=19+20)
BM_LatencyHash<RandStrings< true, 32>, CarbonHashBench>                       13.9ns ± 1%   8.3ns ± 1%  -40.71%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 64>, CarbonHashBench>                       16.8ns ± 1%  13.8ns ± 0%  -17.83%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 256>, CarbonHashBench>                      31.7ns ± 1%  31.2ns ± 0%   -1.76%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 512>, CarbonHashBench>                      43.5ns ± 0%  49.8ns ± 0%  +14.56%  (p=0.000 n=18+20)
BM_LatencyHash<RandStrings< true, 1024>, CarbonHashBench>                     66.2ns ± 0%  86.9ns ± 0%  +31.39%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 2048>, CarbonHashBench>                      112ns ± 0%   163ns ± 0%  +46.09%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 4096>, CarbonHashBench>                      201ns ± 0%   312ns ± 0%  +55.49%  (p=0.000 n=20+20)
BM_LatencyHash<RandStrings< true, 8192>, CarbonHashBench>                      379ns ± 0%   610ns ± 0%  +61.08%  (p=0.000 n=20+20)
```

Note that there is a significant regression on long strings compared to
LLVM's hash function on the ARM server I have access to. This doesn't
show up on the M1 at all, and is likely specific to inadequate
throughput for the 64-bit multiply operations. This seems fine as a) our
priority is for short strings, and b) the M1 and other ARM CPUs are
likely to improve here over time given the prevalent use of this core
technique. For example, Abseil's current hash algorithm has the same
long-string behavior (and performance bottleneck) on this server.

---------

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Geoff Romer <gromer@google.com>
2023-11-20 19:59:06 +00:00
Jon Ross-Perkins 456d165258 Diagnose repeat Main//default files as a redundant api file. (#3408) 2023-11-17 20:10:56 +00:00
Jon Ross-PerkinsandChandler Carruth 5943208f75 Change Main//default to an api file (#3403)
When there is no `package` directive, default to `Main//default api`
instead of
`Main//default impl`. This means:

- The extension will be `.carbon`, not `.impl.carbon`.
- There can only be one such file when compiling.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-11-16 18:57:45 +00:00
josh11b df9494a948 Restore interface declaration parse test (#3406)
The declaration test was made the same as the empty body test in #2649.
This change restores it to test parsing a forward declaration of an
interface.
2023-11-16 18:48:39 +00:00
Chandler Carruth d3eae6d1f0 Fix a crash on invalid found by fuzzing. (#3404)
When a `namespace` keyword has no `;` following it, we recover by
building a parse tree `Namespace` node from the `Namespace` token (as
there isn't a `;` token). Allow this correspondence on errors.

Also teach the diagnostics in this case to avoid the end-of-file token
as that's almost always going to be a less meaningful location. Instead,
we can point at the introducer which should at least be in the code that
led to the error.
2023-11-16 18:26:39 +00:00
Jon Ross-Perkins 204c04dbb9 Add more package and import support. (#3402)
This should cover:

```
library "lib" api;
import Foo library default;
import library default;
import library "lib";
```

This splits out `PackageName` and `LibraryName` to their own parse nodes
so that checking can ignore them and still get a balanced parse tree
(otherwise, we essentially need to implement handling of the parse nodes
only to remove the identifiers/string literals -- the optional names
mean we can't blindly do that as before). For reference, these nodes
don't need to be handled because CheckParseTree will need to directly
funnel import information along with checked IRs.
2023-11-16 17:09:36 +00:00
Chandler Carruthandjosh11b 49d46bd8a4 Add up to 10 retries to our test action. (#3401)
This captures the exit code of Bazel and checks for success or permanent
errors on each attempt. It also sleeps a small amount between attempts.
We should be able to increase the retries and sleeps as needed to
minimize flakiness here, and Bazel should even persist incremental
progress efficiently. Hopefully this helps reduce the failure rate of
our CI.

It also changes how we build on a `push` to use a single Bazel clause to
hold this logic.

Managed to get one of the download failures when testing this, and the
retry logic worked but there was a bug in the success logic.

Otherwise seems to work:
- Synthetic failure:
https://github.com/carbon-language/carbon-lang/actions/runs/6872431707/job/18690894069
- Success:
https://github.com/carbon-language/carbon-lang/actions/runs/6872461061

---------

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2023-11-15 15:34:50 +00:00
josh11bandRichard Smith d21e7b4f14 Detect duplicate member names in struct and struct type literals (#3395)
A struct with the same member name twice can cause a `CARBON_CHECK`
failure later when it is used (problem found by fuzzing).

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-11-15 06:12:03 +00:00
josh11b 7d8afed6f7 Abbreviate "Initialization" -> "Init" (#3398)
Part of switching to the [abbreviations we've decided to
use](https://docs.google.com/document/d/1RRYMm42osyqhI2LyjrjockYCutQ5dOf8Abu50kTrkX0/edit?resourcekey=0-kHyqOESbOHmzZphUbtLrTw#heading=h.pph7i5m5un7q).
2023-11-15 05:36:16 +00:00
josh11b 7af364c12c Don't abbreviate 'element' (#3400)
Decision:
https://discord.com/channels/655572317891461132/655578254970716160/1174103988317212692
2023-11-15 05:24:09 +00:00
josh11b 729ea69385 parameter -> param file renaming (#3397)
Finishes work started in #3392
2023-11-14 22:29:16 +00:00
Jon Ross-PerkinsandRichard Smith d024403dc4 Refactor checking flow to allow for ordering based on import/package. (#3379)
As I was working on this, I noticed `import` and `library` syntax needs
to be fixed for how it imports the current package, and for `Main`
libraries. This mostly reflects the current state in its testing.

Otherwise, this should handle most of the errors I could think of:
dependency cycles, redundant imports, etc.

It does not actually deal with the nuances of cross-IR references.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-11-14 22:24:03 +00:00
josh11b 09b5ab14d8 Link to Swift undecidable type-system problems (#3394) 2023-11-14 00:15:25 +00:00
Richard SmithandJon Ross-Perkins 2715e2276e Parsing and basic checking for abstract class and base class. (#3385)
For now, we require the same introducer to be used each time a class is
declared, but see #3384.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2023-11-13 20:38:21 +00:00
Richard Smith 49591d1360 Add some testing that self and Self don't conflict with r#self and r#Self. (#3381) 2023-11-13 20:24:07 +00:00
josh11bandJon Ross-Perkins c53b248800 Abbreviate "parameter" -> "param" (#3392)
Part of switching to the [abbreviations we've decided to
use](https://docs.google.com/document/d/1RRYMm42osyqhI2LyjrjockYCutQ5dOf8Abu50kTrkX0/edit?resourcekey=0-kHyqOESbOHmzZphUbtLrTw#heading=h.pph7i5m5un7q).

I will rename files in a follow-up PR.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2023-11-13 19:06:54 +00:00
josh11b 522dcc44c5 Finish "declaration" -> "decl" (#3391)
Some new uses of "declaration" introduced in #3374 were missed in #3382
since #3374 was still in flight.
2023-11-13 16:01:40 +00:00
Jacob Schneider 482d233def fix crash caused by unicode chars (#3387)
Prevent a crash during lexing for unicode chars.
2023-11-11 06:27:15 +00:00
Richard Smith abedf08816 Reduce the compile time of the typed_insts_test by a further 40% or so. (#3390)
Move the non-dependent portions of templates out into separate functions
so that we don't need to repeatedly generate code for them.
2023-11-11 00:31:55 +00:00
josh11b 109e7889dd Rename files to use abbreviations (#3389)
Reflects these recent PRs:
* #3375 
* #3382
2023-11-11 00:25:40 +00:00
Jon Ross-PerkinsandChandler Carruth cafcd88882 Split lexing logic and storage to separate files. (#3365)
Just reorganizing logic a little, trying to mirror the direction we've
gone with check, lower, etc. That is, lex.h contains a function `Lex`
that is used directly.

Note, I'm avoiding making meaningful changes here. It could in theory
still affect inlining in benchmarks, but I'm not seeing an impact.

Before:

```
------------------------------------------------------------------------------------------------------
Benchmark                                            Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------------------------------
BM_ValidKeywords                               2784949 ns      2784867 ns          249 bytes_per_second=214.452M/s tokens_per_second=35.9084M/s
BM_ValidKeywordsAsRawIdentifiers               3222597 ns      3222551 ns          210 bytes_per_second=244.513M/s tokens_per_second=31.0313M/s
BM_RawIdentifierFocus                          5907836 ns      5907518 ns          103 bytes_per_second=264.873M/s tokens_per_second=16.9276M/s
BM_ValidIdentifiers<1, 64, false>              6255128 ns      6254297 ns          105 bytes_per_second=235.488M/s tokens_per_second=15.989M/s
BM_ValidIdentifiers<1, 1, true>                3677630 ns      3677398 ns          192 bytes_per_second=77.7999M/s tokens_per_second=27.1931M/s
BM_ValidIdentifiers<3, 5, true>                5427693 ns      5427116 ns          110 bytes_per_second=105.434M/s tokens_per_second=18.426M/s
BM_ValidIdentifiers<3, 16, true>               5063246 ns      5062761 ns          115 bytes_per_second=216.623M/s tokens_per_second=19.7521M/s
BM_ValidIdentifiers<12, 64, true>              5518589 ns      5518118 ns          100 bytes_per_second=691.264M/s tokens_per_second=18.1221M/s
BM_ValidIdentifiers<16, 16, true>              4890776 ns      4890782 ns          112 bytes_per_second=350.989M/s tokens_per_second=20.4466M/s
BM_ValidIdentifiers<24, 24, true>              4974729 ns      4974582 ns          112 bytes_per_second=498.444M/s tokens_per_second=20.1022M/s
BM_ValidIdentifiers<32, 32, true>              5517583 ns      5517085 ns           99 bytes_per_second=587.718M/s tokens_per_second=18.1255M/s
BM_ValidIdentifiers<48, 48, true>              5914759 ns      5914222 ns           94 bytes_per_second=806.255M/s tokens_per_second=16.9084M/s
BM_ValidIdentifiers<64, 64, true>              7556040 ns      7556036 ns           77 bytes_per_second=833.009M/s tokens_per_second=13.2345M/s
BM_ValidIdentifiers<80, 80, true>              7739113 ns      7737696 ns           76 bytes_per_second=1010.65M/s tokens_per_second=12.9237M/s
BM_HorizontalWhitespace/1                      5015062 ns      5014443 ns          108 bytes_per_second=114.111M/s tokens_per_second=19.9424M/s
BM_HorizontalWhitespace/4                      5165496 ns      5165425 ns          111 bytes_per_second=166.163M/s tokens_per_second=19.3595M/s
BM_HorizontalWhitespace/16                     5616796 ns      5616447 ns          102 bytes_per_second=356.578M/s tokens_per_second=17.8049M/s
BM_HorizontalWhitespace/64                     7912904 ns      7912346 ns           78 bytes_per_second=831.648M/s tokens_per_second=12.6385M/s
BM_HorizontalWhitespace/128                   11086218 ns     11083155 ns           57 bytes_per_second=1.11759G/s tokens_per_second=9.0227M/s
BM_RandomSource                                4796549 ns      4795733 ns          145 bytes_per_second=216.783M/s lines_per_second=6.61943M/s tokens_per_second=20.8519M/s
BM_GroupingSymbols/1/0/0                       3937151 ns      3936581 ns          176 bytes_per_second=216.914M/s lines_per_second=19.0521M/s tokens_per_second=25.4028M/s
BM_GroupingSymbols/2/0/0                       3000029 ns      2999506 ns          239 bytes_per_second=243.125M/s lines_per_second=27.7812M/s tokens_per_second=33.3388M/s
BM_GroupingSymbols/3/0/0                       2729059 ns      2728834 ns          251 bytes_per_second=261.26M/s lines_per_second=32.065M/s tokens_per_second=36.6457M/s
BM_GroupingSymbols/4/0/0                       2432363 ns      2432209 ns          291 bytes_per_second=304.738M/s lines_per_second=37.0034M/s tokens_per_second=41.1149M/s
BM_GroupingSymbols/8/0/0                       2144080 ns      2143967 ns          326 bytes_per_second=468.547M/s lines_per_second=44.0468M/s tokens_per_second=46.6425M/s
BM_GroupingSymbols/16/0/0                      2290055 ns      2289711 ns          308 bytes_per_second=741.709M/s lines_per_second=42.3866M/s tokens_per_second=43.6736M/s
BM_GroupingSymbols/32/0/0                      3102790 ns      3102186 ns          220 bytes_per_second=1027.1M/s lines_per_second=31.7437M/s tokens_per_second=32.2353M/s
BM_GroupingSymbols/0/1/0                       3406964 ns      3406421 ns          207 bytes_per_second=222.677M/s lines_per_second=7.33908M/s tokens_per_second=29.3563M/s
BM_GroupingSymbols/0/2/0                       2244101 ns      2244006 ns          312 bytes_per_second=239.985M/s lines_per_second=7.42689M/s tokens_per_second=44.5632M/s
BM_GroupingSymbols/0/3/0                       1976449 ns      1976080 ns          347 bytes_per_second=216M/s lines_per_second=6.32566M/s tokens_per_second=50.6052M/s
BM_GroupingSymbols/0/4/0                       1600539 ns      1600325 ns          429 bytes_per_second=224.777M/s lines_per_second=6.24873M/s tokens_per_second=62.4873M/s
BM_GroupingSymbols/0/8/0                       1085044 ns      1084941 ns          646 bytes_per_second=222.765M/s lines_per_second=5.12009M/s tokens_per_second=92.1709M/s
BM_GroupingSymbols/0/16/0                       824804 ns       824756 ns          817 bytes_per_second=209.166M/s lines_per_second=3.5659M/s tokens_per_second=121.248M/s
BM_GroupingSymbols/0/32/0                       685741 ns       685741 ns         1004 bytes_per_second=196.576M/s lines_per_second=2.20929M/s tokens_per_second=145.828M/s
BM_GroupingSymbols/0/0/1                       3467507 ns      3467077 ns          206 bytes_per_second=218.781M/s lines_per_second=7.21069M/s tokens_per_second=28.8427M/s
BM_GroupingSymbols/0/0/2                       2284154 ns      2283937 ns          309 bytes_per_second=235.79M/s lines_per_second=7.29705M/s tokens_per_second=43.784M/s
BM_GroupingSymbols/0/0/3                       1965548 ns      1965225 ns          356 bytes_per_second=217.193M/s lines_per_second=6.36059M/s tokens_per_second=50.8848M/s
BM_GroupingSymbols/0/0/4                       1623965 ns      1623725 ns          440 bytes_per_second=221.538M/s lines_per_second=6.15868M/s tokens_per_second=61.5868M/s
BM_GroupingSymbols/0/0/8                       1080601 ns      1080452 ns          650 bytes_per_second=223.691M/s lines_per_second=5.14137M/s tokens_per_second=92.5539M/s
BM_GroupingSymbols/0/0/16                       840820 ns       840677 ns          828 bytes_per_second=205.205M/s lines_per_second=3.49837M/s tokens_per_second=118.952M/s
BM_GroupingSymbols/0/0/32                       707793 ns       707734 ns          991 bytes_per_second=190.467M/s lines_per_second=2.14063M/s tokens_per_second=141.296M/s
BM_GroupingSymbols/32/1/0                      2804159 ns      2803869 ns          245 bytes_per_second=1103.7M/s lines_per_second=34.0779M/s tokens_per_second=35.665M/s
BM_GroupingSymbols/32/2/0                      2676229 ns      2675855 ns          261 bytes_per_second=1123.78M/s lines_per_second=34.688M/s tokens_per_second=37.3712M/s
BM_GroupingSymbols/32/3/0                      2652102 ns      2651836 ns          262 bytes_per_second=1103.24M/s lines_per_second=34.0217M/s tokens_per_second=37.7097M/s
BM_GroupingSymbols/32/4/0                      2600677 ns      2600552 ns          268 bytes_per_second=1096.17M/s lines_per_second=33.7678M/s tokens_per_second=38.4534M/s
BM_GroupingSymbols/32/8/0                      2382017 ns      2381869 ns          294 bytes_per_second=1083.42M/s lines_per_second=33.2659M/s tokens_per_second=41.9838M/s
BM_GroupingSymbols/32/16/0                     2102340 ns      2102243 ns          325 bytes_per_second=1034.45M/s lines_per_second=31.5377M/s tokens_per_second=47.5682M/s
BM_GroupingSymbols/32/32/0                     1745079 ns      1744914 ns          403 bytes_per_second=952.64M/s lines_per_second=28.6461M/s tokens_per_second=57.3094M/s
BM_GroupingSymbols/32/32/1                     1701414 ns      1701255 ns          415 bytes_per_second=962.73M/s lines_per_second=28.9228M/s tokens_per_second=58.7802M/s
BM_GroupingSymbols/32/32/2                     1688503 ns      1688121 ns          415 bytes_per_second=957.019M/s lines_per_second=28.7242M/s tokens_per_second=59.2375M/s
BM_GroupingSymbols/32/32/3                     1679701 ns      1679499 ns          419 bytes_per_second=948.651M/s lines_per_second=28.446M/s tokens_per_second=59.5416M/s
BM_GroupingSymbols/32/32/4                     1647815 ns      1647816 ns          427 bytes_per_second=953.342M/s lines_per_second=28.559M/s tokens_per_second=60.6864M/s
BM_GroupingSymbols/32/32/8                     1581283 ns      1581075 ns          450 bytes_per_second=942.39M/s lines_per_second=28.1201M/s tokens_per_second=63.2481M/s
BM_GroupingSymbols/32/32/16                    1445591 ns      1445526 ns          477 bytes_per_second=936.105M/s lines_per_second=27.7442M/s tokens_per_second=69.179M/s
BM_GroupingSymbols/32/32/32                    1296335 ns      1296094 ns          544 bytes_per_second=882.943M/s lines_per_second=25.8276M/s tokens_per_second=77.1549M/s
BM_BlankLines/1                                5774442 ns      5774454 ns          107 bytes_per_second=99.0921M/s lines_per_second=17.3175M/s tokens_per_second=17.3177M/s
BM_BlankLines/4                                8712135 ns      8711977 ns           75 bytes_per_second=98.5198M/s lines_per_second=45.9133M/s tokens_per_second=11.4785M/s
BM_BlankLines/16                              32313782 ns     32307655 ns           22 bytes_per_second=61.9884M/s lines_per_second=49.5234M/s tokens_per_second=3.09524M/s
BM_BlankLines/64                              87562163 ns     87543476 ns            7 bytes_per_second=75.166M/s lines_per_second=73.1058M/s tokens_per_second=1.14229M/s
BM_BlankLines/128                            160336428 ns    160298644 ns            4 bytes_per_second=79.1257M/s lines_per_second=79.8502M/s tokens_per_second=623.836k/s
BM_CommentLines/1/0/0                          7298959 ns      7298427 ns           89 bytes_per_second=117.601M/s lines_per_second=27.4029M/s tokens_per_second=13.7016M/s
BM_CommentLines/4/0/0                         10002223 ns     10002239 ns           67 bytes_per_second=171.622M/s lines_per_second=49.9883M/s tokens_per_second=9.99776M/s
BM_CommentLines/128/0/0                      143356660 ns    143356412 ns            5 bytes_per_second=259.444M/s lines_per_second=89.9846M/s tokens_per_second=697.562k/s
BM_CommentLines/1/30/0                         7421994 ns      7421289 ns           87 bytes_per_second=501.166M/s lines_per_second=26.9492M/s tokens_per_second=13.4747M/s
BM_CommentLines/4/30/0                        11304903 ns     11303972 ns           56 bytes_per_second=1.13696G/s lines_per_second=44.2318M/s tokens_per_second=8.84645M/s
BM_CommentLines/128/30/0                     156244144 ns    156217089 ns            4 bytes_per_second=2.52178G/s lines_per_second=82.5766M/s tokens_per_second=640.135k/s
BM_CommentLines/1/70/0                         7486688 ns      7485340 ns           80 bytes_per_second=1006.49M/s lines_per_second=26.7186M/s tokens_per_second=13.3594M/s
BM_CommentLines/4/70/0                        14762881 ns     14761417 ns           45 bytes_per_second=1.88011G/s lines_per_second=33.8717M/s tokens_per_second=6.77442M/s
BM_CommentLines/128/70/0                     179933089 ns    179903592 ns            4 bytes_per_second=4.84025G/s lines_per_second=71.7044M/s tokens_per_second=555.853k/s
BM_CommentLines/1/0/2                          7473119 ns      7472370 ns           87 bytes_per_second=140.389M/s lines_per_second=26.765M/s tokens_per_second=13.3826M/s
BM_CommentLines/4/0/2                          9702727 ns      9700268 ns           66 bytes_per_second=255.615M/s lines_per_second=51.5445M/s tokens_per_second=10.309M/s
BM_CommentLines/128/0/2                      140504132 ns    140480254 ns            5 bytes_per_second=438.544M/s lines_per_second=91.8269M/s tokens_per_second=711.844k/s
BM_CommentLines/1/30/2                         7530847 ns      7529227 ns           82 bytes_per_second=519.314M/s lines_per_second=26.5629M/s tokens_per_second=13.2816M/s
BM_CommentLines/4/30/2                        11646677 ns     11644972 ns           56 bytes_per_second=1.16764G/s lines_per_second=42.9366M/s tokens_per_second=8.5874M/s
BM_CommentLines/128/30/2                     161292392 ns    161273904 ns            4 bytes_per_second=2.59054G/s lines_per_second=79.9873M/s tokens_per_second=620.063k/s
BM_CommentLines/1/70/2                         7700751 ns      7700365 ns           83 bytes_per_second=1003.16M/s lines_per_second=25.9725M/s tokens_per_second=12.9864M/s
BM_CommentLines/4/70/2                        14133018 ns     14131523 ns           45 bytes_per_second=2.01664G/s lines_per_second=35.3815M/s tokens_per_second=7.07638M/s
BM_CommentLines/128/70/2                     179085026 ns    179057072 ns            4 bytes_per_second=4.99628G/s lines_per_second=72.0433M/s tokens_per_second=558.481k/s
BM_CommentLines/1/0/8                          7792060 ns      7791951 ns           83 bytes_per_second=208.065M/s lines_per_second=25.6673M/s tokens_per_second=12.8338M/s
BM_CommentLines/4/0/8                         10329194 ns     10329006 ns           61 bytes_per_second=461.644M/s lines_per_second=48.4069M/s tokens_per_second=9.68147M/s
BM_CommentLines/128/0/8                      140917902 ns    140917975 ns            5 bytes_per_second=956.927M/s lines_per_second=91.5417M/s tokens_per_second=709.633k/s
BM_CommentLines/1/30/8                         7813308 ns      7811702 ns           82 bytes_per_second=573.784M/s lines_per_second=25.6024M/s tokens_per_second=12.8013M/s
BM_CommentLines/4/30/8                        12052779 ns     12051440 ns           54 bytes_per_second=1.31373G/s lines_per_second=41.4884M/s tokens_per_second=8.29776M/s
BM_CommentLines/128/30/8                     163767409 ns    163753783 ns            4 bytes_per_second=2.9881G/s lines_per_second=78.776M/s tokens_per_second=610.673k/s
BM_CommentLines/1/70/8                         8188137 ns      8187614 ns           80 bytes_per_second=1013.35M/s lines_per_second=24.4269M/s tokens_per_second=12.2136M/s
BM_CommentLines/4/70/8                        15723650 ns     15721559 ns           43 bytes_per_second=1.95485G/s lines_per_second=31.8031M/s tokens_per_second=6.36069M/s
BM_CommentLines/128/70/8                     182579515 ns    182554119 ns            4 bytes_per_second=5.29237G/s lines_per_second=70.6633M/s tokens_per_second=547.783k/s
BM_SpeedOfLightStrCpy                            27009 ns        27006 ns        25887 bytes_per_second=37.594G/s lines_per_second=1.17547G/s tokens_per_second=3.70286G/s
BM_SpeedOfLightDispatch<1>                     1850860 ns      1850660 ns          381 bytes_per_second=561.764M/s lines_per_second=17.1533M/s tokens_per_second=54.0348M/s
BM_SpeedOfLightDispatch<2>                     1876473 ns      1876369 ns          347 bytes_per_second=554.067M/s lines_per_second=16.9183M/s tokens_per_second=53.2944M/s
BM_SpeedOfLightDispatch<4>                     2208441 ns      2208443 ns          314 bytes_per_second=470.755M/s lines_per_second=14.3744M/s tokens_per_second=45.2808M/s
BM_SpeedOfLightDispatch<8>                     2824174 ns      2824137 ns          250 bytes_per_second=368.125M/s lines_per_second=11.2406M/s tokens_per_second=35.409M/s
BM_SpeedOfLightDispatch<16>                    4306633 ns      4306325 ns          165 bytes_per_second=241.42M/s lines_per_second=7.37172M/s tokens_per_second=23.2217M/s
BM_SpeedOfLightDispatch<32>                    6300653 ns      6300102 ns          113 bytes_per_second=165.019M/s lines_per_second=5.03881M/s tokens_per_second=15.8728M/s
BM_SpeedOfLightDispatch<MaxDispatchTargets>    8879663 ns      8878510 ns           79 bytes_per_second=117.096M/s lines_per_second=3.57549M/s tokens_per_second=11.2632M/s
```

After:

```
------------------------------------------------------------------------------------------------------
Benchmark                                            Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------------------------------
BM_ValidKeywords                               2821833 ns      2821832 ns          247 bytes_per_second=211.642M/s tokens_per_second=35.438M/s
BM_ValidKeywordsAsRawIdentifiers               3204326 ns      3203964 ns          216 bytes_per_second=245.931M/s tokens_per_second=31.2113M/s
BM_RawIdentifierFocus                          6076723 ns      6076107 ns           98 bytes_per_second=257.524M/s tokens_per_second=16.4579M/s
BM_ValidIdentifiers<1, 64, false>              6303093 ns      6302632 ns          101 bytes_per_second=233.682M/s tokens_per_second=15.8664M/s
BM_ValidIdentifiers<1, 1, true>                3687668 ns      3687338 ns          194 bytes_per_second=77.5902M/s tokens_per_second=27.1198M/s
BM_ValidIdentifiers<3, 5, true>                5298920 ns      5298465 ns          106 bytes_per_second=107.994M/s tokens_per_second=18.8734M/s
BM_ValidIdentifiers<3, 16, true>               4880695 ns      4879704 ns          118 bytes_per_second=224.75M/s tokens_per_second=20.493M/s
BM_ValidIdentifiers<12, 64, true>              5413070 ns      5411832 ns          103 bytes_per_second=704.84M/s tokens_per_second=18.478M/s
BM_ValidIdentifiers<16, 16, true>              5052780 ns      5051309 ns          110 bytes_per_second=339.835M/s tokens_per_second=19.7968M/s
BM_ValidIdentifiers<24, 24, true>              5221580 ns      5220851 ns          104 bytes_per_second=474.933M/s tokens_per_second=19.154M/s
BM_ValidIdentifiers<32, 32, true>              5786811 ns      5786806 ns           99 bytes_per_second=560.325M/s tokens_per_second=17.2807M/s
BM_ValidIdentifiers<48, 48, true>              5959506 ns      5959502 ns           96 bytes_per_second=800.129M/s tokens_per_second=16.7799M/s
BM_ValidIdentifiers<64, 64, true>              7831469 ns      7830629 ns           75 bytes_per_second=803.799M/s tokens_per_second=12.7704M/s
BM_ValidIdentifiers<80, 80, true>              7905843 ns      7904727 ns           75 bytes_per_second=989.298M/s tokens_per_second=12.6507M/s
BM_HorizontalWhitespace/1                      5091171 ns      5090660 ns          109 bytes_per_second=112.402M/s tokens_per_second=19.6438M/s
BM_HorizontalWhitespace/4                      5020344 ns      5020344 ns          112 bytes_per_second=170.965M/s tokens_per_second=19.919M/s
BM_HorizontalWhitespace/16                     5846801 ns      5846459 ns           99 bytes_per_second=342.549M/s tokens_per_second=17.1044M/s
BM_HorizontalWhitespace/64                     7803183 ns      7802357 ns           78 bytes_per_second=843.372M/s tokens_per_second=12.8166M/s
BM_HorizontalWhitespace/128                   10600500 ns     10598602 ns           59 bytes_per_second=1.16869G/s tokens_per_second=9.43521M/s
BM_RandomSource                                4824062 ns      4823496 ns          139 bytes_per_second=215.536M/s lines_per_second=6.58133M/s tokens_per_second=20.7319M/s
BM_GroupingSymbols/1/0/0                       4116846 ns      4116549 ns          170 bytes_per_second=207.431M/s lines_per_second=18.2191M/s tokens_per_second=24.2922M/s
BM_GroupingSymbols/2/0/0                       3024336 ns      3024156 ns          236 bytes_per_second=241.144M/s lines_per_second=27.5548M/s tokens_per_second=33.0671M/s
BM_GroupingSymbols/3/0/0                       2789794 ns      2789256 ns          252 bytes_per_second=255.601M/s lines_per_second=31.3704M/s tokens_per_second=35.8519M/s
BM_GroupingSymbols/4/0/0                       2496498 ns      2496237 ns          283 bytes_per_second=296.921M/s lines_per_second=36.0543M/s tokens_per_second=40.0603M/s
BM_GroupingSymbols/8/0/0                       2200846 ns      2200611 ns          313 bytes_per_second=456.487M/s lines_per_second=42.9131M/s tokens_per_second=45.4419M/s
BM_GroupingSymbols/16/0/0                      2415237 ns      2415015 ns          288 bytes_per_second=703.225M/s lines_per_second=40.1873M/s tokens_per_second=41.4076M/s
BM_GroupingSymbols/32/0/0                      3171195 ns      3170504 ns          215 bytes_per_second=1004.97M/s lines_per_second=31.0597M/s tokens_per_second=31.5407M/s
BM_GroupingSymbols/0/1/0                       3627393 ns      3626737 ns          193 bytes_per_second=209.15M/s lines_per_second=6.89325M/s tokens_per_second=27.573M/s
BM_GroupingSymbols/0/2/0                       2501189 ns      2500946 ns          275 bytes_per_second=215.33M/s lines_per_second=6.66388M/s tokens_per_second=39.9849M/s
BM_GroupingSymbols/0/3/0                       2149513 ns      2149282 ns          318 bytes_per_second=198.593M/s lines_per_second=5.8159M/s tokens_per_second=46.5272M/s
BM_GroupingSymbols/0/4/0                       1793658 ns      1793292 ns          384 bytes_per_second=200.59M/s lines_per_second=5.57634M/s tokens_per_second=55.7634M/s
BM_GroupingSymbols/0/8/0                       1302555 ns      1302272 ns          542 bytes_per_second=185.589M/s lines_per_second=4.26562M/s tokens_per_second=76.7889M/s
BM_GroupingSymbols/0/16/0                      1042993 ns      1042818 ns          671 bytes_per_second=165.428M/s lines_per_second=2.82024M/s tokens_per_second=95.8941M/s
BM_GroupingSymbols/0/32/0                       955561 ns       955471 ns          749 bytes_per_second=141.082M/s lines_per_second=1.58561M/s tokens_per_second=104.66M/s
BM_GroupingSymbols/0/0/1                       3659797 ns      3659369 ns          194 bytes_per_second=207.285M/s lines_per_second=6.83178M/s tokens_per_second=27.3271M/s
BM_GroupingSymbols/0/0/2                       2467556 ns      2467190 ns          281 bytes_per_second=218.276M/s lines_per_second=6.75505M/s tokens_per_second=40.5319M/s
BM_GroupingSymbols/0/0/3                       2152274 ns      2151938 ns          326 bytes_per_second=198.348M/s lines_per_second=5.80872M/s tokens_per_second=46.4697M/s
BM_GroupingSymbols/0/0/4                       1805982 ns      1805877 ns          368 bytes_per_second=199.192M/s lines_per_second=5.53747M/s tokens_per_second=55.3747M/s
BM_GroupingSymbols/0/0/8                       1313041 ns      1312833 ns          539 bytes_per_second=184.096M/s lines_per_second=4.23131M/s tokens_per_second=76.1711M/s
BM_GroupingSymbols/0/0/16                      1065565 ns      1065301 ns          659 bytes_per_second=161.937M/s lines_per_second=2.76072M/s tokens_per_second=93.8702M/s
BM_GroupingSymbols/0/0/32                       946630 ns       946514 ns          726 bytes_per_second=142.417M/s lines_per_second=1.60061M/s tokens_per_second=105.651M/s
BM_GroupingSymbols/32/1/0                      2991120 ns      2991121 ns          233 bytes_per_second=1034.6M/s lines_per_second=31.9445M/s tokens_per_second=33.4323M/s
BM_GroupingSymbols/32/2/0                      2893280 ns      2892944 ns          245 bytes_per_second=1039.45M/s lines_per_second=32.085M/s tokens_per_second=34.5669M/s
BM_GroupingSymbols/32/3/0                      2819177 ns      2819024 ns          239 bytes_per_second=1037.81M/s lines_per_second=32.004M/s tokens_per_second=35.4733M/s
BM_GroupingSymbols/32/4/0                      2778376 ns      2778018 ns          249 bytes_per_second=1026.15M/s lines_per_second=31.6107M/s tokens_per_second=35.9969M/s
BM_GroupingSymbols/32/8/0                      2538279 ns      2538279 ns          275 bytes_per_second=1016.65M/s lines_per_second=31.216M/s tokens_per_second=39.3968M/s
BM_GroupingSymbols/32/16/0                     2291819 ns      2291693 ns          305 bytes_per_second=948.937M/s lines_per_second=28.9306M/s tokens_per_second=43.6359M/s
BM_GroupingSymbols/32/32/0                     1943560 ns      1943560 ns          366 bytes_per_second=855.273M/s lines_per_second=25.7183M/s tokens_per_second=51.452M/s
BM_GroupingSymbols/32/32/1                     1902069 ns      1901915 ns          375 bytes_per_second=861.158M/s lines_per_second=25.8713M/s tokens_per_second=52.5786M/s
BM_GroupingSymbols/32/32/2                     1877847 ns      1877752 ns          379 bytes_per_second=860.371M/s lines_per_second=25.8234M/s tokens_per_second=53.2552M/s
BM_GroupingSymbols/32/32/3                     1837280 ns      1837016 ns          381 bytes_per_second=867.308M/s lines_per_second=26.0069M/s tokens_per_second=54.4361M/s
BM_GroupingSymbols/32/32/4                     1841010 ns      1840902 ns          380 bytes_per_second=853.349M/s lines_per_second=25.5636M/s tokens_per_second=54.3212M/s
BM_GroupingSymbols/32/32/8                     1734676 ns      1734437 ns          405 bytes_per_second=859.062M/s lines_per_second=25.6337M/s tokens_per_second=57.6556M/s
BM_GroupingSymbols/32/32/16                    1641169 ns      1640934 ns          422 bytes_per_second=824.63M/s lines_per_second=24.4403M/s tokens_per_second=60.9409M/s
BM_GroupingSymbols/32/32/32                    1506988 ns      1506914 ns          472 bytes_per_second=759.418M/s lines_per_second=22.2143M/s tokens_per_second=66.3608M/s
BM_BlankLines/1                                5658057 ns      5657150 ns          110 bytes_per_second=101.147M/s lines_per_second=17.6766M/s tokens_per_second=17.6767M/s
BM_BlankLines/4                                8346196 ns      8346052 ns           77 bytes_per_second=102.839M/s lines_per_second=47.9264M/s tokens_per_second=11.9817M/s
BM_BlankLines/16                              31147085 ns     31144610 ns           22 bytes_per_second=64.3033M/s lines_per_second=51.3727M/s tokens_per_second=3.21083M/s
BM_BlankLines/64                              83743719 ns     83743762 ns            8 bytes_per_second=78.5765M/s lines_per_second=76.4228M/s tokens_per_second=1.19412M/s
BM_BlankLines/128                            152299627 ns    152274606 ns            4 bytes_per_second=83.2952M/s lines_per_second=84.0578M/s tokens_per_second=656.708k/s
BM_CommentLines/1/0/0                          7535704 ns      7535149 ns           83 bytes_per_second=113.906M/s lines_per_second=26.542M/s tokens_per_second=13.2711M/s
BM_CommentLines/4/0/0                         10107724 ns     10106088 ns           66 bytes_per_second=169.858M/s lines_per_second=49.4746M/s tokens_per_second=9.89503M/s
BM_CommentLines/128/0/0                      130061022 ns    130029826 ns            5 bytes_per_second=286.034M/s lines_per_second=99.207M/s tokens_per_second=769.054k/s
BM_CommentLines/1/30/0                         7773816 ns      7772726 ns           83 bytes_per_second=478.506M/s lines_per_second=25.7307M/s tokens_per_second=12.8655M/s
BM_CommentLines/4/30/0                        11436116 ns     11434452 ns           56 bytes_per_second=1.12398G/s lines_per_second=43.7271M/s tokens_per_second=8.7455M/s
BM_CommentLines/128/30/0                     155047059 ns    155033899 ns            4 bytes_per_second=2.54103G/s lines_per_second=83.2068M/s tokens_per_second=645.02k/s
BM_CommentLines/1/70/0                         8016209 ns      8014861 ns           75 bytes_per_second=939.998M/s lines_per_second=24.9534M/s tokens_per_second=12.4768M/s
BM_CommentLines/4/70/0                        14894752 ns     14891800 ns           44 bytes_per_second=1.86365G/s lines_per_second=33.5752M/s tokens_per_second=6.7151M/s
BM_CommentLines/128/70/0                     176667108 ns    176631061 ns            4 bytes_per_second=4.92993G/s lines_per_second=73.0329M/s tokens_per_second=566.152k/s
BM_CommentLines/1/0/2                          7764475 ns      7763675 ns           84 bytes_per_second=135.121M/s lines_per_second=25.7607M/s tokens_per_second=12.8805M/s
BM_CommentLines/4/0/2                         10238104 ns     10236809 ns           65 bytes_per_second=242.217M/s lines_per_second=48.8429M/s tokens_per_second=9.76867M/s
BM_CommentLines/128/0/2                      130208823 ns    130190640 ns            5 bytes_per_second=473.204M/s lines_per_second=99.0845M/s tokens_per_second=768.104k/s
BM_CommentLines/1/30/2                         7941224 ns      7940584 ns           78 bytes_per_second=492.411M/s lines_per_second=25.1868M/s tokens_per_second=12.5935M/s
BM_CommentLines/4/30/2                        11936879 ns     11934453 ns           56 bytes_per_second=1.13932G/s lines_per_second=41.8951M/s tokens_per_second=8.3791M/s
BM_CommentLines/128/30/2                     156978531 ns    156967142 ns            4 bytes_per_second=2.66162G/s lines_per_second=82.182M/s tokens_per_second=637.076k/s
BM_CommentLines/1/70/2                         8223614 ns      8222923 ns           79 bytes_per_second=939.409M/s lines_per_second=24.322M/s tokens_per_second=12.1611M/s
BM_CommentLines/4/70/2                        15216239 ns     15215047 ns           45 bytes_per_second=1.87303G/s lines_per_second=32.8619M/s tokens_per_second=6.57244M/s
BM_CommentLines/128/70/2                     176810589 ns    176755958 ns            4 bytes_per_second=5.06133G/s lines_per_second=72.9813M/s tokens_per_second=565.752k/s
BM_CommentLines/1/0/8                          7901146 ns      7899003 ns           82 bytes_per_second=205.245M/s lines_per_second=25.3194M/s tokens_per_second=12.6598M/s
BM_CommentLines/4/0/8                         10135919 ns     10134576 ns           66 bytes_per_second=470.501M/s lines_per_second=49.3356M/s tokens_per_second=9.86721M/s
BM_CommentLines/128/0/8                      132206448 ns    132206347 ns            5 bytes_per_second=1019.98M/s lines_per_second=97.5738M/s tokens_per_second=756.393k/s
BM_CommentLines/1/30/8                         7981189 ns      7981202 ns           79 bytes_per_second=561.598M/s lines_per_second=25.0586M/s tokens_per_second=12.5294M/s
BM_CommentLines/4/30/8                        12311389 ns     12309078 ns           54 bytes_per_second=1.28623G/s lines_per_second=40.62M/s tokens_per_second=8.12409M/s
BM_CommentLines/128/30/8                     160432032 ns    160393999 ns            4 bytes_per_second=3.05069G/s lines_per_second=80.4261M/s tokens_per_second=623.465k/s
BM_CommentLines/1/70/8                         8199080 ns      8199078 ns           79 bytes_per_second=1011.93M/s lines_per_second=24.3927M/s tokens_per_second=12.1965M/s
BM_CommentLines/4/70/8                        16087954 ns     16086159 ns           44 bytes_per_second=1.91055G/s lines_per_second=31.0823M/s tokens_per_second=6.21652M/s
BM_CommentLines/128/70/8                     175714908 ns    175675241 ns            4 bytes_per_second=5.4996G/s lines_per_second=73.4302M/s tokens_per_second=569.232k/s
BM_SpeedOfLightStrCpy                            28860 ns        28858 ns        26092 bytes_per_second=35.181G/s lines_per_second=1.10002G/s tokens_per_second=3.46519G/s
BM_SpeedOfLightDispatch<1>                     1823558 ns      1823473 ns          385 bytes_per_second=570.14M/s lines_per_second=17.4091M/s tokens_per_second=54.8404M/s
BM_SpeedOfLightDispatch<2>                     2013453 ns      2013250 ns          343 bytes_per_second=516.396M/s lines_per_second=15.768M/s tokens_per_second=49.6709M/s
BM_SpeedOfLightDispatch<4>                     2225145 ns      2224920 ns          312 bytes_per_second=467.268M/s lines_per_second=14.2679M/s tokens_per_second=44.9454M/s
BM_SpeedOfLightDispatch<8>                     2851730 ns      2851590 ns          251 bytes_per_second=364.581M/s lines_per_second=11.1324M/s tokens_per_second=35.0682M/s
BM_SpeedOfLightDispatch<16>                    4431584 ns      4431156 ns          161 bytes_per_second=234.619M/s lines_per_second=7.16404M/s tokens_per_second=22.5675M/s
BM_SpeedOfLightDispatch<32>                    6229285 ns      6228092 ns          111 bytes_per_second=166.927M/s lines_per_second=5.09707M/s tokens_per_second=16.0563M/s
BM_SpeedOfLightDispatch<MaxDispatchTargets>    8967228 ns      8965583 ns           79 bytes_per_second=115.958M/s lines_per_second=3.54076M/s tokens_per_second=11.1538M/s
```

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2023-11-10 23:59:49 +00:00
josh11b 11d79a3882 Use x-macro instead of TYPED_TEST for compilation speed (#3388)
Reduces total time to build and run just this test from 25+ seconds to
~16 seconds.
2023-11-10 23:34:13 +00:00
Richard Smith 0fb2924c99 Extend description of parser states to show which tokens they consume. (#3378)
Also some minor improvements and typo fixes to the parser code for
issues found while writing these descriptions.
2023-11-10 22:08:58 +00:00
josh11b b953fbf314 Subexpr -> SubExpr (#3383) 2023-11-10 20:48:46 +00:00
Richard Smith 4aa6a6894d Add missing periods to diagnostics. (#3380) 2023-11-10 20:29:22 +00:00
Richard Smith afd6d85610 Support for returned var and return var. (#3374)
Implement toolchain support for `returned var` and `return var`.

- Modeled `returned` in the parse tree as a `ReturnedSpecifier`
appearing after the `VariableIntroducer`.
- Modeled `return var` in the parse tree as a `ReturnVarSpecifier`
appearing after the `ReturnStatementStart`.
- Factored out the implementation of `return` statement and `returned
var` handling in check into a new `return.{h,cpp}`. The parse nodes
themselves are still handled in `handle_*.cpp`. This allows easy code
reuse between `return` and `returned var`.
2023-11-10 19:52:30 +00:00
josh11b 5020fdb3be Use abbreviation "decl" instead of "declaration" (#3382)
Part of switching to the [abbreviations we've decided to
use](https://docs.google.com/document/d/1RRYMm42osyqhI2LyjrjockYCutQ5dOf8Abu50kTrkX0/edit?resourcekey=0-kHyqOESbOHmzZphUbtLrTw#heading=h.pph7i5m5un7q).

I will rename files in a follow-up PR.
2023-11-10 10:43:25 +00:00
josh11b 11ca083855 Use abbreviation "expr" instead of "expression" (#3375)
Part of switching to the [abbreviations we've decided to
use](https://docs.google.com/document/d/1RRYMm42osyqhI2LyjrjockYCutQ5dOf8Abu50kTrkX0/edit?resourcekey=0-kHyqOESbOHmzZphUbtLrTw#heading=h.pph7i5m5un7q).

I will rename files in a follow-up PR.
2023-11-10 01:32:32 +00:00
Richard Smith 6d5e62974c Add SemIR instruction to track that a conversion was performed. (#3363)
Instead of ad-hoc conversion tracking on some kinds of nodes that
conversion creates, consolidate tracking into a single node kind. This
frees up an operand on `Init` instructions that can be used to store the
destination.
2023-11-09 23:58:54 +00:00
josh11b 681fbf9da2 Add missing #include of base/value_store.h (#3377) 2023-11-09 20:58:18 +00:00
Richard Smith 71aa4a45be Distinguish between name IDs and string IDs in the type system. (#3341)
Add a `NameId` that is effectively just a wrapper around a `StringId`,
with
some additional predefined values for names that don't correspond to
strings, such as the name of `self` or the function's return slot.
2023-11-09 16:51:36 +00:00
Jon Ross-Perkins 84bc8cc4bf Fix crash when if expressions aren't in a function. (#3373)
Another issue found while trying to make `package` work, lurking in
fuzzer inputs. This leaves TODOs because we probably do want to support
this, it's just non-trivial to fix.
2023-11-07 22:14:15 +00:00
Jon Ross-Perkins 50a614aaf3 Fix crash when an expression cannot convert to a type. (#3372)
This turns out to somewhat block `package` support because there's a
fuzzer test-case that does similar. The parse is valid so we should
probably handle it reasonably.

I suspect the `let` test case might work with a little effort, given it
shouldn't really require much evaluation. On the other hand, `var`
definitely shouldn't, and `fn` will probably require something like
`constexpr` plus more substantial compile-time evaluation support.
2023-11-07 21:36:35 +00:00
josh11b f9fb27bdfc Split handlers for aggregates out of lower/handle.cpp into its own file (#3368) 2023-11-06 22:20:16 +00:00
Richard Smith 3bee8932a9 Rework name lookup to handle non-lexical scoping. (#3354)
When declaring a name such as `fn Ns.Class.F() { ... }`, enter the
scopes of `Ns` and `Ns.Class` as we form the name, and remain in those
non-lexical scopes until the end of the declaration.

When performing an unqualified lookup, look in any enclosing non-lexical
scopes in addition to looking into the lexical name table.

We now track a scope index with each lookup result in the lexical name
lookup table. This is used to determine whether a lexical or non-lexcial
result is the innermost result and whether a declared name is in the
same scope as some previous introduction of that name or in a nested
scope. For now, this could just be the index into the scope_stack, but
the intent is to also use this to detect names being declared after they
are first looked up, which requires the indexes to outlive their scopes,
so we use a persistent numbering of all scopes instead. The persistent
numbering also permits more invariant checking.
2023-11-06 19:48:41 +00:00
Jacob Schneider a4c0febc0f handle missing addr in self pointer pattern (#3369)
Add validation to `CheckAddrSelfAccess` to additionally check for
situations where `addr` is potentially missing. I also updated the name
of the function since `me` was renamed to `self`.

Closes #3367
2023-11-06 17:51:08 +00:00
Jon Ross-Perkins fc1d71d382 Split build keys so that a read-write key is only used for merged PRs, and read-only is used otherwise. (#3364)
The final test commit has an example of the push run:

https://github.com/carbon-language/carbon-lang/actions/runs/6748256043/job/18346225812

But pull request runs require merging to trunk, AFAIK. Unfortunately
that means the remote upload disabling isn't really tested in full.
2023-11-06 16:03:58 +00:00
Jacob Schneider c53789e7a4 Fix comment on Declaration (#3371)
Small copy/paste typo fix.
2023-11-06 00:18:39 +00:00
Richard Smith 184eafd521 Add a separate store for computed constant values. (#3362)
This moves the instructions generated for type values out of the block
in which they happen to first be referenced, and into shared storage.
2023-11-04 23:48:13 +00:00
Piyush Udhao a0bacbb26b potential grammatical error fix in docs/project/roadmap.md (#3359)
just noticed this small error while reading through.
I apologize if the change is too insignificant for a PR.
2023-11-03 02:55:15 +00:00
josh11b 0318631d1a Clarify some comments (#3360) 2023-11-03 00:25:05 +00:00
Richard SmithandJon Ross-Perkins 545a5b3679 Support initializing a class from a struct. (#3358)
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2023-11-02 20:27:01 +00:00