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

Divan extra benchmarks #12025

Merged
merged 8 commits into from Mar 9, 2024

Conversation

FilipAndersson245
Copy link
Contributor

@FilipAndersson245 FilipAndersson245 commented Feb 29, 2024

Description

This PR builds on #12000 and adds a few more benchmarks.
one to benchmark how long it takes to eval std, and a few different pipeline commands.

User-Facing Changes

Tests + Formatting

After Submitting

@FilipAndersson245 FilipAndersson245 marked this pull request as draft February 29, 2024 16:23
@kubouch
Copy link
Contributor

kubouch commented Feb 29, 2024

I think it's a good idea to add more benchmarks. Some of the pipeline benchmarks seem quite random, though. For example, the ls depends on the directory contents, which might change. Ideally, the benchmarks should be written with some specific goal in mind. I like the stdlib and config loading and the serialization benchmarks, that's very useful.

@FilipAndersson245
Copy link
Contributor Author

I think it's a good idea to add more benchmarks. Some of the pipeline benchmarks seem quite random, though. For example, the ls depends on the directory contents, which might change. Ideally, the benchmarks should be written with some specific goal in mind. I like the stdlib and config loading and the serialization benchmarks, that's very useful.

Yee the ls one was mostly as an initial test I had, I still think its interesting to track performance of simple IO command as they are so commonly used, I think they should be benchmarked to ensure they are snappy. I think the test of a simple for loop is quite straightforward, but the other one I more or less copied from this script inside nu_scripts.

@sholderbach
Copy link
Member

After fixing conflicts this seems pretty straightforward to get into a shape so we can land those additions and iterate on our benchmarks, right?

@FilipAndersson245
Copy link
Contributor Author

After fixing conflicts this seems pretty straightforward to get into a shape so we can land those additions and iterate on our benchmarks, right?

Yes, I have just been busy this last week will try to fix it today. :)

@FilipAndersson245 FilipAndersson245 marked this pull request as ready for review March 9, 2024 15:59
@FilipAndersson245
Copy link
Contributor Author

This PR is ready for review.

Copy link
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

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

I think we don't have to be perfect here yet and can observe and improve our benchmarks so we really draw some conclusions about future design decisions.

Thanks for moving us in the right direction @FilipAndersson245

benches/benchmarks.rs Show resolved Hide resolved
load_standard_library(&mut engine).unwrap();
let commands = Spanned {
span: Span::unknown(),
item: format!("(1..{}) | each {{|_| sleep 50ns }} | ignore", n).to_string(),
Copy link
Member

Choose a reason for hiding this comment

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

Does using ignore here have a relevant impact?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure, the problem is to get rid of the output that is displayed so it doesn't clutter the screen, if there is another way to do it I'm all for it.

load_standard_library(&mut engine).unwrap();
let commands = Spanned {
span: Span::unknown(),
item: format!("(1..{}) | par-each -t 2 {{|_| sleep 50ns }} | ignore", n).to_string(),
Copy link
Member

Choose a reason for hiding this comment

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

shrugs at the limited number of core's on github workers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think this should be removed or changed?, even if cores are low just allowing multiple commands to be run parallel allow some level of parallelism even if its run on 1 thread machine. I initially added this test as I saw 1thread par-each outperform the standard each for low sample counts.

@sholderbach sholderbach merged commit d05f94e into nushell:main Mar 9, 2024
19 checks passed
@FilipAndersson245 FilipAndersson245 deleted the divan-extra-benchmarks branch March 9, 2024 17:15
@kubouch kubouch added this to the v0.92.0 milestone Mar 9, 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.

None yet

3 participants