Skip to content

Conversation

@urmez
Copy link

@urmez urmez commented Jan 19, 2026

No description provided.

@google-cla
Copy link

google-cla bot commented Jan 19, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@urmez urmez changed the title Optimization to Skip this entire family - no instances will match Optimization to Skip this entire family Jan 19, 2026
@dmah42
Copy link
Member

dmah42 commented Jan 19, 2026

can you add tests please? and run the formatter.

// Check if the filter spec starts with the family name
// or if the family name appears as a substring in the spec
family_could_match = spec.find(family->name_) != std::string::npos ||
spec == "." ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

The . special case should probably be checked first.


// Optimization: Quick check if family name could match the filter
// before iterating through all args combinations
bool family_name_disabled = family->name_.rfind(kDisabledPrefix, 0) == 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why rfind() though, instead of find()?
That being said i think it might make sense to define a helper function string_has_prefix() for this...

Copy link
Author

Choose a reason for hiding this comment

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

No rfind now. let me know what you think of latest code.

The optimization only works for literal string to skip the complete
family and all its args
spec which is regex, so a pre-check is needed to make sure to skip
only on a litral string match and not when its regex.

Added a unit test to measure the speedup
@urmez
Copy link
Author

urmez commented Jan 20, 2026

Member

@dmah42 "run the formatter" : explain or point to the documentation on what and how to run this

@dmah42
Copy link
Member

dmah42 commented Jan 20, 2026

There is a clang format CI job failing. A clang format config file is located in the root of the project. Running clang-format is standard practice I think, but hopefully this gives you enough to go on.

Comment on lines +91 to +100
// Verify optimization provides at least 5x speedup
if (speedup < 5.0) {
std::cerr << "ERROR: Expected at least 5x speedup, got " << speedup << "x\n";
std::cerr << "Optimization may not be working correctly!\n";
return -1;
}
} else {
std::cerr << "ERROR: Literal filter completed too fast to measure accurately\n";
return -1;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not a good idea to make tests depend on host machie performance.

Comment on lines +181 to +184
if (!is_negative_filter && !family_contains_literal) {
// Positive filter: family name doesn't contain literal, skip family
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't this errneously skip BM_Family/arg1/arg2 given filter BM_Family/arg ?

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.

3 participants