Skip to content

Conversation

dmitryax
Copy link
Member

Use the same copy logic for primitive slices as for the complex.

The opposite approach of #13293.

Apparently, there is slight improvement when 10-items slice is copied into 7-items slice.

Not sure if we want to complicate the logic for this insignificant gain.

before

goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/collector/pdata/internal
cpu: Apple M1 Max
BenchmarkCopyOrigInt64Slice/0_to_7-10         	 8608524	       139.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkCopyOrigInt64Slice/1_to_7-10         	 8533219	       140.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkCopyOrigInt64Slice/7_to_7-10         	 8768828	       137.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkCopyOrigInt64Slice/10_to_7-10        	 7211601	       164.7 ns/op	     112 B/op	       1 allocs/op
BenchmarkCopyOrigInt64Slice/20_to_7-10        	 7005366	       171.8 ns/op	     160 B/op	       1 allocs/op
BenchmarkCopyOrigInt64Slice/50_to_7-10        	 5943145	       209.0 ns/op	     416 B/op	       1 allocs/op

after

BenchmarkCopyOrigInt64Slice/0_to_7-10         	 8667313	       140.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkCopyOrigInt64Slice/1_to_7-10         	 8764303	       136.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkCopyOrigInt64Slice/7_to_7-10         	 8669146	       139.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkCopyOrigInt64Slice/10_to_7-10        	 7425303	       160.8 ns/op	      80 B/op	       1 allocs/op
BenchmarkCopyOrigInt64Slice/20_to_7-10        	 6743520	       177.6 ns/op	     160 B/op	       1 allocs/op
BenchmarkCopyOrigInt64Slice/50_to_7-10        	 5643139	       213.9 ns/op	     416 B/op	       1 allocs/op

Use the same copy logic for primitive slices as for the complex
@github-actions github-actions bot requested a review from bogdandrutu June 29, 2025 16:32
@dmitryax dmitryax changed the title [WIP] [pdata] Consolidate CopyOrig logic for slices [DO NOT MERGE] [pdata] Consolidate CopyOrig logic for slices Jun 29, 2025
Copy link

codecov bot commented Jun 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.61%. Comparing base (c6cd1ae) to head (e48bf83).
⚠️ Report is 129 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13294   +/-   ##
=======================================
  Coverage   91.61%   91.61%           
=======================================
  Files         522      522           
  Lines       29120    29126    +6     
=======================================
+ Hits        26679    26685    +6     
  Misses       1925     1925           
  Partials      516      516           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 15, 2025
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant