Add benchmarks that measure KeyPath read and write performance. (#60383)

* Add benchmarks that measure KeyPath read and write performance.

* Added setUpFunctions. Revised number of iterations per benchmark.

* Include n as a factor in the number of iterations.

* Increased number of iterations for KeyPathDirectAccess by a factor of 25.

* One last tweak to the number of iterations on testDirectAccess to get them above 20 us.

* Made revisions based on feedback. Added three new benchmarks.

* Added benchmarks to exhaustively benchmark all KeyPathComponent types. Removed benchmarks dealing with an inlining issue.

* Wrapped additional keypaths with identity() where needed. More cleanup and documentation.

* Moved KeyPaths for KeyPathRead and Write into FixedSizeArrayHolder. Renamed GetSet to Getset.

* Added inline(never) to both versions of getKeypathToElement().

* Moved identity() wraps so that they're called once per variable per benchmark.

* Moving destinationKeyPaths into FixedSizeArrayHolder to try to reduce long setup overhead errors.

* Additional moving of the identity() wrapping into the singleton's init() to try to reduce setup time errors.
This commit is contained in:
fibrechannelscsi
2022-08-24 12:55:05 -06:00
committed by GitHub
parent 18a211c6c3
commit 730bf24035
3 changed files with 1704 additions and 0 deletions

View File

@@ -106,6 +106,7 @@ set(SWIFT_BENCH_MODULES
single-source/Integrate
single-source/IterateData
single-source/Join
single-source/KeyPathPerformanceTests
single-source/LazyFilter
single-source/LinkedList
single-source/LuhnAlgoEager

File diff suppressed because it is too large Load Diff

View File

@@ -97,6 +97,7 @@ import IntegerParsing
import Integrate
import IterateData
import Join
import KeyPathPerformanceTests
import LazyFilter
import LinkedList
import LuhnAlgoEager
@@ -279,6 +280,7 @@ register(Integrate.benchmarks)
register(IterateData.benchmarks)
register(Join.benchmarks)
register(LazyFilter.benchmarks)
register(KeyPathPerformanceTests.benchmarks)
register(LinkedList.benchmarks)
register(LuhnAlgoEager.benchmarks)
register(LuhnAlgoLazy.benchmarks)