Avatar for the cloudflare user
cloudflare
workerd
BlogDocsChangelog

[nfc] Add StrongBool::toBool()

#4522Merged
Comparing
harris/2025-07-14-strong-bool-to-bool
(
5a484c5
) with
main
(
487fd1e
)
CodSpeed Performance Gauge
+19%
Improvements
1
Untouched
10

Benchmarks

Improved

SlowAPIWithLock[FastMethodFixture]
src/workerd/tests/bench-fast-api.c++::SlowAPIWithLock[FastMethodFixture]
CodSpeed Performance Gauge
+19%
34.7 ms29.2 ms

Passed

request[RegExpBenchmark]
src/workerd/tests/bench-regex.c++::request[RegExpBenchmark]
CodSpeed Performance Gauge
0%
7.4 ms7.4 ms
Test_JSON_ENC
src/workerd/tests/bench-json.c++::Test_JSON_ENC
CodSpeed Performance Gauge
0%
196 ms196 ms
ParseAndSerialize
Mimetype::ParseAndSerialize
CodSpeed Performance Gauge
0%
78.6 ms78.6 ms
SlowAPI[FastMethodFixture]
src/workerd/tests/bench-fast-api.c++::SlowAPI[FastMethodFixture]
CodSpeed Performance Gauge
0%
37.3 ms37.3 ms
Parse[KjHeaders]
src/workerd/tests/bench-kj-headers.c++::Parse[KjHeaders]
CodSpeed Performance Gauge
0%
44.3 µs44.3 µs
Util_RecursivelyFreeze
src/workerd/tests/bench-util.c++::Util_RecursivelyFreeze
CodSpeed Performance Gauge
0%
10.8 ms10.8 ms
Serialize
Mimetype::Serialize
CodSpeed Performance Gauge
0%
96.9 ms96.9 ms
constructor[ApiHeaders]
src/workerd/tests/bench-api-headers.c++::constructor[ApiHeaders]
CodSpeed Performance Gauge
0%
71 ms71 ms
request[GlobalScopeBenchmark]
src/workerd/tests/bench-global-scope.c++::request[GlobalScopeBenchmark]
CodSpeed Performance Gauge
0%
56.8 ms56.8 ms
Test_JSON_DEC
src/workerd/tests/bench-json.c++::Test_JSON_DEC
CodSpeed Performance Gauge
0%
3.2 s3.2 s

Commits

Click on a commit to change the comparison range
Base
main
487fd1e
+18.9%
[nfc] Add StrongBool::toBool() I belatedly recalled that I shouldn't be using functional-style casts, since they implicitly perform a const_cast. In this case, it's not a big risk, but in theory someone could change a strong bool type to some other type with a non-const `operator bool()`, causing a safety issue. The type already supports static_cast, of course, but no one's going to want to use that.
5a484c5
2 months ago
by harrishancock
© 2025 CodSpeed Technology
Home Terms Privacy Docs