Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small optimization for fsfinder #136

Merged
merged 13 commits into from
Aug 3, 2024
Merged

Conversation

SkobelkinYaroslav
Copy link
Contributor

some optimization and added benchmark to test it

@kehoecj kehoecj added the OSS Community Contribution Contributions from the OSS Community label Apr 4, 2024
@kehoecj kehoecj self-requested a review April 10, 2024 15:23
@kehoecj kehoecj added the waiting-on-maintainer-review PR is waiting to be reviewed and functionally tested by the maintainers label Apr 11, 2024
@kehoecj
Copy link
Collaborator

kehoecj commented May 30, 2024

Output of the benchmark run go test -v --bench=Benchmark_Finder -benchtime 5s -benchmem ./...

goos: darwin
goarch: amd64
pkg: github.com/Boeing/config-file-validator/pkg/finder
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Benchmark_Finder
Benchmark_Finder-12    	    6346	    823069 ns/op	   75869 B/op	     628 allocs/op

and here's the benchmark against the main branch finder:

goos: darwin
goarch: amd64
pkg: github.com/Boeing/config-file-validator/pkg/finder
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Benchmark_Finder
Benchmark_Finder-12    	    7038	    769833 ns/op	   79535 B/op	     634 allocs/op

Some pretty clear improvements. Thanks @SkobelkinYaroslav !

Copy link
Collaborator

@kehoecj kehoecj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! - one comment on commented code

@kehoecj kehoecj added pr-action-requested PR is awaiting feedback from the submitting developer and removed waiting-on-maintainer-review PR is waiting to be reviewed and functionally tested by the maintainers labels May 30, 2024
pkg/finder/finder_test.go Outdated Show resolved Hide resolved
pkg/finder/finder_test.go Outdated Show resolved Hide resolved
@kehoecj kehoecj removed the pr-action-requested PR is awaiting feedback from the submitting developer label Aug 3, 2024
@kehoecj kehoecj merged commit e601c40 into Boeing:main Aug 3, 2024
10 checks passed
shiina4119 pushed a commit to shiina4119/config-file-validator that referenced this pull request Aug 23, 2024
* changed []string to map[string]struct{} in FileSystemFinder struct fields because of optimization (arrays were used only to check the occurrence of an element)

* Changed field Extensions type in FileType from []string to map[string]struct{}

* added requested changes

* small refactoring of findOne func

* fixd the return value

* get back to trimprefix func

* cleanup

* fsfinder optimization

* i hope it fixed

* removed unnecessary calls to filepath.Abs

* Apply suggestions from code review

---------

Co-authored-by: Yaroslav <=>
Co-authored-by: Clayton Kehoe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OSS Community Contribution Contributions from the OSS Community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants