1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:24:48 -07:00
go/src/path
Joe Tsai 2551324cd0 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>
2022-09-23 04:34:52 +00:00
..
filepath path/filepath: optimize isReservedName 2022-09-23 04:34:52 +00:00
example_test.go path,path/filepath: add Join examples with ".." components 2020-08-19 00:10:22 +00:00
match_test.go io/fs, path, path/filepath, testing/fstest: validate patterns in Match, Glob 2020-10-23 14:59:03 +00:00
match.go all: remove trailing blank doc comment lines 2022-04-01 18:18:07 +00:00
path_test.go path: avoid import of strings 2020-10-13 01:12:09 +00:00
path.go all: gofmt main repo 2022-04-11 16:34:30 +00:00