Skip to content

perf: optimize it.Trim to use DropLastWhile(DropWhile(...))#780

Merged
samber merged 1 commit intosamber:masterfrom
d-enk:optimize-seq-trim
Feb 8, 2026
Merged

perf: optimize it.Trim to use DropLastWhile(DropWhile(...))#780
samber merged 1 commit intosamber:masterfrom
d-enk:optimize-seq-trim

Conversation

@d-enk
Copy link
Contributor

@d-enk d-enk commented Jan 22, 2026

Change Trim to use DropLastWhile(DropWhile(...)) instead of DropWhile(DropLastWhile(...))

This is more efficient because DropWhile doesn't use a buffer, so it removes leading elements first, then DropLastWhile works with a smaller collection.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.18%. Comparing base (2859d73) to head (24883aa).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #780   +/-   ##
=======================================
  Coverage   94.18%   94.18%           
=======================================
  Files          18       18           
  Lines        2872     2872           
=======================================
  Hits         2705     2705           
  Misses        151      151           
  Partials       16       16           
Flag Coverage Δ
unittests 94.18% <ø> (ø)

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

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

@d-enk d-enk force-pushed the optimize-seq-trim branch from e36a205 to ce2ad2d Compare January 22, 2026 13:57
@d-enk d-enk changed the title perf: optimize seq.Trim to use DropLastWhile(DropWhile(...)) perf: optimize it.Trim to use DropLastWhile(DropWhile(...)) Jan 22, 2026
Change Trim to use DropLastWhile(DropWhile(...)) instead of DropWhile(DropLastWhile(...))

This is more efficient because DropWhile doesn't use a buffer, so it removes
leading elements first, then DropLastWhile works with a smaller collection.
@d-enk d-enk force-pushed the optimize-seq-trim branch from ce2ad2d to 24883aa Compare January 22, 2026 14:26
@samber samber merged commit a822176 into samber:master Feb 8, 2026
11 checks passed
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