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

bench: Represent paths with fs::path instead of std::string #24252

Merged
merged 1 commit into from Feb 5, 2022

Conversation

ryanofsky
Copy link
Contributor

Suggested #20744 (comment)

@DrahtBot DrahtBot added the Tests label Feb 3, 2022
@maflcko
Copy link
Member

maflcko commented Feb 3, 2022

cr ACK 3278e64

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

Concept ACK.

After changing type single quotes are redundant as path object is already quoted with double quotes:

std::cout << "Could write to file '" << filename << "'" << std::endl;

std::cout << "Created '" << filename << "'" << std::endl;


While here, is it a good chance for some fixes?

  1. It seems a negation should be used in the following message:
    std::cout << "Could write to file '" << filename << "'" << std::endl;
  2. Shouldn't the following line
    std::cout << "Created '" << filename << "'" << std::endl;
    be moved into the if branch above?

@@ -24,13 +24,13 @@ const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{};

namespace {

void GenerateTemplateResults(const std::vector<ankerl::nanobench::Result>& benchmarkResults, const std::string& filename, const char* tpl)
void GenerateTemplateResults(const std::vector<ankerl::nanobench::Result>& benchmarkResults, const fs::path& filename, const char* tpl)
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/filename/file/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: s/filename/file/ ?

Sure, changed

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK 3278e64

Also uses fs::path quoting in bench printed strings and fixes a
misleading error message.

Originally suggested bitcoin#20744 (comment)

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Updated 3278e64 -> 824e1ff (pr/bp.1 -> pr/bp.2, compare) with suggested changes. Thanks!

@@ -24,13 +24,13 @@ const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{};

namespace {

void GenerateTemplateResults(const std::vector<ankerl::nanobench::Result>& benchmarkResults, const std::string& filename, const char* tpl)
void GenerateTemplateResults(const std::vector<ankerl::nanobench::Result>& benchmarkResults, const fs::path& filename, const char* tpl)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: s/filename/file/ ?

Sure, changed

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

untested ACK 824e1ff

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK 824e1ff, tested on Linux Mint 20.2 (x86_64).

@fanquake fanquake merged commit 372cb6c into bitcoin:master Feb 5, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 6, 2022
…std::string

824e1ff bench: Represents paths with fs::path instead of std::string (Ryan Ofsky)

Pull request description:

  Suggested bitcoin#20744 (comment)

ACKs for top commit:
  fanquake:
    untested ACK 824e1ff
  hebasto:
    ACK 824e1ff, tested on Linux Mint 20.2 (x86_64).

Tree-SHA512: 348fc189f30b5ad9a8e49e95e535d2c044462a9d534c3f34d887fbde0c05c41e88e02b4fc340709e6395a1188496a8333eb9e734310aa4c41755ec080e53c06e
@bitcoin bitcoin locked and limited conversation to collaborators Feb 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants