Skip to content

Use optimized filepath.WalkDir function instead of filepath.Walk#15

Open
hismailbulut wants to merge 1 commit into
adrg:masterfrom
hismailbulut:master
Open

Use optimized filepath.WalkDir function instead of filepath.Walk#15
hismailbulut wants to merge 1 commit into
adrg:masterfrom
hismailbulut:master

Conversation

@hismailbulut

Copy link
Copy Markdown

A simple test shows the performance difference

Test with filepath.Walk:
goos: windows
goarch: amd64
pkg: github.com/adrg/sysfont
cpu: Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz
BenchmarkNewFinder-4 3 466802100 ns/op
PASS
ok github.com/adrg/sysfont 2.978s

Test with filepath.WalkDir:
goos: windows
goarch: amd64
pkg: github.com/adrg/sysfont
cpu: Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz
BenchmarkNewFinder-4 3 427294700 ns/op
PASS
ok github.com/adrg/sysfont 2.743s

@adrg

adrg commented Oct 10, 2021

Copy link
Copy Markdown
Owner

Hi @hismailbulut. Thank you for the PR. I would love to adopt this change at this point. However filepath.WalkDir was introduced in Go v1.16 (which was just released on February 16, 2021).

That means that I would force the Go v1.16 restriction on all packages already using this one in future releases.
I'll most certainly transition to filepath.WalkDir in the future, but I think it's a bit too soon right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants