benchmarks: Add a basic set of benchmarks

Add google benchmark to the DEPs.

Implement a basic set of benchmarks for each of the writers and the WGSL parser.

Add build rules for CMake. GN build rules TODO.

Add a simple go tool (ported from Marl) to diff two benchmarks. Less
noisy than the one provided by google benchmark.

Bug: tint:1378
Change-Id: I73cf92c5d9fd2d3bfac8f264864fd774afbd5d01
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/76840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton
2022-01-18 18:58:16 +00:00
committed by Tint LUCI CQ
parent dcb24cea41
commit be2362b18c
44 changed files with 2655 additions and 64 deletions

View File

@@ -56,13 +56,7 @@ bool ReadFile(const std::string& input_file, std::vector<T>* buffer) {
}
fseek(file, 0, SEEK_END);
auto tell_file_size = ftell(file);
if (tell_file_size <= 0) {
std::cerr << "Input file of incorrect size: " << input_file << std::endl;
fclose(file);
return {};
}
const auto file_size = static_cast<size_t>(tell_file_size);
const auto file_size = static_cast<size_t>(ftell(file));
if (0 != (file_size % sizeof(T))) {
std::cerr << "File " << input_file
<< " does not contain an integral number of objects: "