| // Copyright 2022 The Tint Authors. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // File generated by tools/src/cmd/gen |
| // using the template: |
| // src/tint/type/short_name_bench.cc.tmpl |
| // |
| // Do not modify this file directly |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| #include "src/tint/type/short_name.h" |
| |
| #include <array> |
| |
| #include "benchmark/benchmark.h" |
| |
| namespace tint::type { |
| namespace { |
| |
| void ShortNameParser(::benchmark::State& state) { |
| std::array kStrings{ |
| "veccf", "32", "vVc2f", "vec2f", "vec21", "qqeJf", "vecll7f", "veqH2pp", |
| "vh", "Gebh", "vec2h", "vevi2h", "ve8WWh", "Mxxc2", "vgg2i", "V2X", |
| "vec23", "vec2i", "vec2E", "TTeP2i", "vxxcdd", "v44c2u", "veVVSSu", "22RRu", |
| "vec2u", "vF2u", "vecu", "ROOHVu", "ecyf", "n77rrlcGf", "vec340", "vec3f", |
| "oof", "vezz", "1ipp3f", "XXec3h", "ve9IInn5h", "HHreSSaYh", "vec3h", "kk3", |
| "jgRR", "veb", "vjc3i", "vc3i", "vcq", "vec3i", "Nec3i", "vcvv", |
| "ve3QQ", "vrcf", "vecju", "NNew23", "vec3u", "ve3u", "vrrc3u", "Gec3u", |
| "veFF4f", "vE", "verrf", "vec4f", "vef", "veJJD", "v4", "e4k", |
| "vech", "Jech", "vec4h", "ec4h", "_KKttcH", "vexxh", "__qcF", "vc4qq", |
| "33e64i", "vec4i", "6QQott4i", "v6c4i", "zzc4O6", "vyyc4u", "vcZZ", "ecWq4u", |
| "vec4u", "vOO4u", "oYe4", "v4", |
| }; |
| for (auto _ : state) { |
| for (auto& str : kStrings) { |
| auto result = ParseShortName(str); |
| benchmark::DoNotOptimize(result); |
| } |
| } |
| } |
| |
| BENCHMARK(ShortNameParser); |
| |
| } // namespace |
| } // namespace tint::type |