commit | 2551324cd01b295915c10c6d3d06625676401610 | [log] [tgz] |
---|---|---|
author | Joe Tsai <joetsai@digital-static.net> | Thu Sep 22 16:54:19 2022 -0700 |
committer | Gopher Robot <gobot@golang.org> | Fri Sep 23 04:34:52 2022 +0000 |
tree | 19c7efe7b981bfaa81d0180cdd94bb1196b03bf5 | |
parent | c2ede92a0d461cca8ab5fba8840e15670710fbd9 [diff] |
path/filepath: optimize isReservedName A linear search through a list of 22 strings takes ~80ns. A quick check for 3-4 byte strings reduces this check to 2ns for a vast majority of inputs. In the event of a name match, the new logic is either just as fast (for "CON") or 10x faster (for "LPT9"). Change-Id: I412fa73beebd7c81dc95f9ed12c35ca1d5d6baf0 Reviewed-on: https://go-review.googlesource.com/c/go/+/433175 Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Ian Lance Taylor <iant@google.com>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.