Skip to content

[DO NOT MERGE] [pdata] Consolidate CopyOrig logic for slices #13294

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

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).

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.

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.

1 participant