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

[ws-daemon] Improve path concatenation #5143

Merged
merged 1 commit into from
Aug 11, 2021
Merged

[ws-daemon] Improve path concatenation #5143

merged 1 commit into from
Aug 11, 2021

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Aug 11, 2021

No description provided.

@roboquat roboquat requested a review from fntlnz August 11, 2021 01:30
@aledbf
Copy link
Member Author

aledbf commented Aug 11, 2021

/hold

@codecov
Copy link

codecov bot commented Aug 11, 2021

Codecov Report

Merging #5143 (c404487) into main (5e232e8) will increase coverage by 23.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           main    #5143       +/-   ##
=========================================
+ Coverage      0   23.10%   +23.10%     
=========================================
  Files         0       11       +11     
  Lines         0     1922     +1922     
=========================================
+ Hits          0      444      +444     
- Misses        0     1419     +1419     
- Partials      0       59       +59     
Flag Coverage Δ
components-ws-daemon-app 23.10% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
components/ws-daemon/pkg/content/tar.go 46.71% <100.00%> (ø)
components/ws-daemon/pkg/content/service.go 0.00% <0.00%> (ø)
...onents/ws-daemon/pkg/internal/session/workspace.go 50.73% <0.00%> (ø)
components/ws-daemon/pkg/content/config.go 62.50% <0.00%> (ø)
components/ws-daemon/pkg/resources/controller.go 33.69% <0.00%> (ø)
components/ws-daemon/pkg/internal/session/store.go 19.38% <0.00%> (ø)
components/ws-daemon/pkg/resources/limiter.go 77.77% <0.00%> (ø)
components/ws-daemon/pkg/content/archive.go 57.47% <0.00%> (ø)
components/ws-daemon/pkg/resources/dispatch.go 0.00% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e232e8...c404487. Read the comment docs.

@@ -86,7 +87,10 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
}

if relFilePath != "." {
relFilePath = strings.Join([]string{".", relFilePath}, string(filepath.Separator))
buffer := bytes.NewBufferString(".")
Copy link
Contributor

Choose a reason for hiding this comment

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

better? filepath.Join

Copy link
Member Author

@aledbf aledbf Aug 11, 2021

Choose a reason for hiding this comment

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

Not really (for readibility you are 💯)

❯ go test -benchmem -run=^$ -bench . bench_test.go | prettybench
goos: linux
goarch: amd64
cpu: AMD Ryzen 9 5900X 12-Core Processor            
PASS
benchmark                                    iter     time/iter   bytes alloc        allocs
---------                                    ----     ---------   -----------        ------
BenchmarkNewBufferString-24              76683656   15.20 ns/op        0 B/op   0 allocs/op
BenchmarkNewBufferStringParallel/1-24   880934428    1.38 ns/op        0 B/op   0 allocs/op
BenchmarkNewBufferStringParallel/2-24   793567332    1.53 ns/op        0 B/op   0 allocs/op
BenchmarkNewBufferStringParallel/4-24   826919538    1.50 ns/op        0 B/op   0 allocs/op
BenchmarkNewBufferStringParallel/8-24   809302243    1.46 ns/op        0 B/op   0 allocs/op
BenchmarkFilePathJoin-24                 13993242   83.81 ns/op       40 B/op   3 allocs/op
BenchmarkFilePathJoinParallel/1-24       94575600   13.63 ns/op       40 B/op   3 allocs/op
BenchmarkFilePathJoinParallel/2-24       72334652   14.96 ns/op       40 B/op   3 allocs/op
BenchmarkFilePathJoinParallel/4-24       80168283   15.62 ns/op       40 B/op   3 allocs/op
BenchmarkFilePathJoinParallel/8-24       71974920   15.55 ns/op       40 B/op   3 allocs/op
ok  	command-line-arguments	12.709s

Copy link
Member Author

Choose a reason for hiding this comment

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

To be clear, I am trying to tackle this issue
Screenshot from 2021-08-10 21-24-54

Copy link
Contributor

Choose a reason for hiding this comment

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

wow, that's surprising. Thank's for the benchmark 🚀

@csweichel
Copy link
Contributor

/lgtm

@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: 70f8080ff29c25d9098ebf20ed561d9d95a1ef05

@csweichel
Copy link
Contributor

/approve no-issue

@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: csweichel

Associated issue requirement bypassed by: csweichel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit b476939 into main Aug 11, 2021
@roboquat roboquat deleted the aledbf/concat branch August 11, 2021 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants