Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Fix doc tests and examples for Measure::this() #20833

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

brooksprumo
Copy link
Contributor

@brooksprumo brooksprumo commented Oct 20, 2021

Problem

The doc tests in Measure::this() were ignored since I didn't fully implement them before.

Summary of Changes

Fix the doc tests so they are not ignored, and add more/better examples.

Here's what the docs look like now:
Screen Shot 2021-10-20 at 4 14 25 PM

@brooksprumo brooksprumo marked this pull request as ready for review October 20, 2021 21:34
@codecov
Copy link

codecov bot commented Oct 21, 2021

Codecov Report

Merging #20833 (4bc8f27) into master (7baeb04) will decrease coverage by 0.0%.
The diff coverage is 43.1%.

@@            Coverage Diff            @@
##           master   #20833     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         496      496             
  Lines      138317   138409     +92     
=========================================
+ Hits       113319   113390     +71     
- Misses      24998    25019     +21     

/// let (result, measure) = Measure::this(|(arg1, arg2)| my_function(arg1, arg2), ("abc", 123), "my_func");
/// # use solana_measure::measure::Measure;
/// # fn my_function(fizz: i32) -> i32 { fizz }
/// let (result, measure) = Measure::this(my_function, 42, "my_func");
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps it would be a good idea to have an example of using measure as well. It would be useful in order to demonstrate what exactly the value of measure "means" and how one might use it in the context of a test or benchmark.

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 think that makes sense. I think that would apply more to the actual Measure struct itself, or at the module level. Since this is just for the this() function, I wanted to keep the examples limited to just using this().

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense!

@brooksprumo brooksprumo merged commit 842ff77 into solana-labs:master Oct 21, 2021
@brooksprumo brooksprumo deleted the measure branch October 21, 2021 15:07
dankelleher pushed a commit to identity-com/solana that referenced this pull request Nov 24, 2021
frits-metalogix added a commit to identity-com/solana that referenced this pull request Nov 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants