Skip to content

Reduce number of String allocations #6

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 16 commits into
base: main
Choose a base branch
from
Draft

Reduce number of String allocations #6

wants to merge 16 commits into from

Conversation

sunsided
Copy link
Owner

@sunsided sunsided commented May 23, 2024

Implements a possible solution for #5. Builds upon #3 for the ToString support. The lazy evaluation allows to defer the to_string() call until the rendering actually takes place.

@sunsided sunsided self-assigned this May 23, 2024
@sunsided sunsided changed the title Add lazy evaluation support (#5) Add lazy evaluation support May 23, 2024
Copy link

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a2c0a13) to head (2dd9df5).
Report is 23 commits behind head on main.

Current head 2dd9df5 differs from pull request most recent head 70532fe

Please upload reports for the commit 70532fe to get more accurate results.

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #6   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          132       207   +75     
=========================================
+ Hits           132       207   +75     

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

@sunsided
Copy link
Owner Author

After adding indirection via QueryPart<'a>, performance degraded:

     Running benches/bench.rs (target/release/deps/bench-8bd30fe3b3e7b365)
with_value              time:   [416.94 ns 439.28 ns 463.03 ns]
                        change: [+11.309% +16.696% +22.573%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe

with_opt_value          time:   [943.02 ns 968.75 ns 994.36 ns]
                        change: [+7.9468% +12.170% +16.164%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
  7 (7.00%) high mild

push_opt_and_append     time:   [654.08 ns 668.25 ns 685.17 ns]
                        change: [+38.901% +43.454% +48.391%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe

@sunsided sunsided changed the title Add lazy evaluation support Reduce number of String allocations May 24, 2024
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