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

perf: use capacity_builder::FastDisplay #42

Merged
merged 11 commits into from
Dec 18, 2024

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Dec 18, 2024

Before:

Timer precision: 100 ns
bench                       fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ package_req                            │               │               │               │         │
│  ╰─ to_string_normalized  1.296 µs      │ 1.491 µs      │ 1.365 µs      │ 1.37 µs       │ 100     │ 100000
├─ version                                │               │               │               │         │
│  ├─ to_string             239.5 ns      │ 316.3 ns      │ 244.5 ns      │ 247.4 ns      │ 100     │ 100000
│  ╰─ to_string_display     244.1 ns      │ 381.8 ns      │ 250.4 ns      │ 256.8 ns      │ 100     │ 100000
╰─ version_req                            │               │               │               │         │
   ├─ to_string             1.101 µs      │ 1.464 µs      │ 1.133 µs      │ 1.141 µs      │ 100     │ 100000
   ├─ to_string_display     1.109 µs      │ 1.3 µs        │ 1.135 µs      │ 1.142 µs      │ 100     │ 100000
   ╰─ to_string_normalized  1.185 µs      │ 1.474 µs      │ 1.232 µs      │ 1.244 µs      │ 100     │ 100000

After:

Timer precision: 100 ns
bench                       fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ package_req                            │               │               │               │         │
│  ╰─ to_string_normalized  1.273 µs      │ 1.459 µs      │ 1.317 µs      │ 1.327 µs      │ 100     │ 100000
├─ version                                │               │               │               │         │
│  ├─ to_string             183.8 ns      │ 268.3 ns      │ 192.3 ns      │ 192.4 ns      │ 100     │ 100000
│  ╰─ to_string_display     234.3 ns      │ 384.9 ns      │ 243.1 ns      │ 246.9 ns      │ 100     │ 100000
╰─ version_req                            │               │               │               │         │
   ├─ to_string             1.086 µs      │ 1.352 µs      │ 1.123 µs      │ 1.133 µs      │ 100     │ 100000
   ├─ to_string_display     1.102 µs      │ 1.371 µs      │ 1.14 µs       │ 1.149 µs      │ 100     │ 100000
   ╰─ to_string_normalized  1.151 µs      │ 1.289 µs      │ 1.169 µs      │ 1.179 µs      │ 100     │ 100000

@dsherret dsherret requested a review from bartlomieju December 18, 2024 01:13
src/lib.rs Outdated Show resolved Hide resolved
@dsherret dsherret removed the request for review from bartlomieju December 18, 2024 02:19
@dsherret dsherret marked this pull request as draft December 18, 2024 02:19
@dsherret dsherret changed the title perf: Version - improve to_string() perf: use capacity_builder::FastDisplay Dec 18, 2024
@dsherret dsherret marked this pull request as ready for review December 18, 2024 04:17
@dsherret dsherret requested a review from bartlomieju December 18, 2024 04:17
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, the changes are not that bad

@dsherret dsherret merged commit d03466c into denoland:main Dec 18, 2024
1 check passed
@dsherret dsherret deleted the perf_improve_to_string_version_perf branch December 18, 2024 20:19
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