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

use Cows again #1

Merged
merged 1 commit into from
Jan 7, 2025
Merged

use Cows again #1

merged 1 commit into from
Jan 7, 2025

Conversation

fiji-flo
Copy link

@fiji-flo fiji-flo commented Jan 6, 2025

First of all great PR!

Since a major part of the work in rari is moving strings around I tried to allocate as little as necessary. When I changed most strings to Cows it really made a difference in sum.

That's why there's Cows everywhere. I'm thinking about making this more ergonomic in the future and I will definitely add this in a contributing guide.

That's the difference in this PR doing a simple get_group("EvalError", &[]):

Running benches/jsref.rs (target/release/deps/jsref-9250feaa2ada967f)
jsref EvalError         time:   [84.634 ns 85.175 ns 85.753 ns]
Running benches/jsref.rs (target/release/deps/jsref-9250feaa2ada967f)
jsref EvalError         time:   [72.245 ns 72.899 ns 73.573 ns]
                        change: [-16.171% -15.542% -14.890%] (p = 0.00 < 0.05)
                        Performance has improved.

Feel free to ping me if you want to chat about this.

@Josh-Cena
Copy link
Owner

OK, the profiling looks convincing. I wouldn't sacrifice a fraction of a millisecond for more readability, but the optimization makes sense.

@Josh-Cena Josh-Cena merged commit 786f590 into Josh-Cena:temporal Jan 7, 2025
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