I am going to add some support here for Linux. I want to make sure that these
changes are hidden from the main CMakeLists.txt file since we want that file to
be as declarative as possible.
rdar://40541972
Today, one can not completely disable a benchmark depending on the platform
without changing the source of main.swift. We would like to be able to disable
benchmarks locally in a benchmark's file without needing to modify the rest of
the infrastructure. The closest that one can get to such behavior is to just
conditionally compile out the file locally. But one still will have the test
run.
This commit adds support for not-running the benchmark on specific
platforms. This in combination with conditional compilation of benchmark bodies,
allows us to not have to comment out module's in main.swift or have to
conditionally compile testinfo.
rdar://40541972
I want to create some larger/more expensive workloads for this. So move all
StringComparison initialization out of the loop just to be standard.
rdar://40371840
Add StringBuilderSmallReservingCapacity variant to measure the excess
overhead caused by calls to reserve capacity. If a string is small,
and the capacity is small, this will demonstrate overhead if an
allocation happens.
* Use the `__has_include` and `GRND_RANDOM` macros
* Use `getentropy` instead of `getrandom`
* Use `std::min` from the <algorithm> header
* Move `#if` out of the `_stdlib_random` function
* Use `getrandom` with "/dev/urandom" fallback
* Use `#pragma comment` to import "Bcrypt.lib"
* <https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp>
* <https://clang.llvm.org/docs/UsersManual.html#microsoft-extensions>
* Use "/dev/urandom" instead of `SecRandomCopyBytes`
* Use `swift::StaticMutex` for shared "/dev/urandom"
* Add `getrandom_available`; use `O_CLOEXEC` flag
Add platform impl docs
Update copyrights
Fix docs
Add _stdlib_random test
Update _stdlib_random test
Add missing &
Notice about _stdlib_random
Fix docs
Guard on upperBound = 0
Test full range of 8 bit integers
Remove some gyb
Clean up integerRangeTest
Remove FixedWidthInteger constraint
Use arc4random universally
Fix randomElement
Constrain shuffle to RandomAccessCollection
warning instead of error
Move Apple's implementation
Fix failing test on 32 bit systems
* [stdlib] Revise documentation for new random APIs
* [stdlib] Fix constraints on random integer generation
* [test] Isolate failing Random test
* [benchmark] Add benchmarks for new random APIs
Fix Float80 test
Value type generators
random -> randomElement
Fix some docs
One more doc fix
Doc fixes & bool fix
Use computed over explicit
Add substring-view-oriented array append benchmarks. Put a
getString/getSubstring call into the innermost loop to prevent some
constant folding towards triviality.
setUpFunction code should be located together with the corresponding runFunction code, so that we can verify them at a glance. However, we can't really do that yet, and doing the setUp for all tests in bulk makes it less likely that we make a mistake in matching up tests with their corresponding setups. :/
Disable the random hash seed while benchmarking. By its nature, it makes the number of hash collisions fluctuate between runs, adding unnecessary noise to benchmark results.
I expect we'll be able to re-enable random seeding here once we have made hash collisions cheaper -- they are currently always resolved by calling the Key's Equatable implementation, which can be expensive.
WordCount shows significant variance between iterations, which is apparently caused by the initialization of someAlphanumerics and asciiWords/utf16Words leaking into the measured part of the benchmark.
Making sure these variables are initialized before we start measuring elapsed time stabilizes the results.
This benchmark script is similar to the guard malloc/runtime runner, but it only
runs the tests. The intention is that one can use this to quickly in a
multithreaded way verify that all benchmarks run successfully. In contrast, the
normal driver will run only single threaded since it is meant to test
performance, so is not able to take advantage of all cores on a system.
I wrote this quickly to verify some benchmark tests still worked. No point in
not sharing with everyone else.
* Benchmark {Float,Double,Float80}.description
This just tests how fast we can format the standard
floating-point types. It also includes a test that
uses the result, to ensure that future optimized
_creation_ of the string doesn't incidentally pessimize
_use_ of the results.
* Benchmark {Float,Double,Float80}.description
This just tests how fast we can format the standard
floating-point types. It also includes a test that
uses the result, to ensure that future optimized
_creation_ of the string doesn't incidentally pessimize
_use_ of the results.
* Add benchmarks for values close to 1 + other review suggestions
Dictionary and Set currently exhibit O(n^2) behavior for certain operations involving copying elements in bulk. Add benchmarks to verify an upcoming fix and to catch regressions later.
https://bugs.swift.org/browse/SR-3268
This is necessary to build standalone benchmarks with leak checking
enabled. This is useful if you want to debug an internal benchmark failure using
a public swift.