-
Notifications
You must be signed in to change notification settings - Fork 25
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
perf: Dependency files caching #129
Conversation
… macro dependencies (copy members)
# Conflicts: # benchmark/benchmark.cpp # parser_library/src/context/copy_member.h # parser_library/test/workspace/workspace_test.cpp
# Conflicts: # parser_library/src/context/operation_code.h
// structure represents invocation of COPY member in HLASM macro library | ||
struct copy_member_invocation | ||
{ | ||
const id_index name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the reason to make these const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the only reason was that it is a structure and it does not make sense to change these members. Getter functions would be certainly better.
for (const auto& [fname, cached_version] : cached_data.stamps) | ||
{ | ||
auto file = file_mngr_->find(fname); | ||
if (!file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we keep like weak_ptr to the file instead of file_manager ref and the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, since file_manager creates new shared pointers to processor_files in the rare cases when the files are accessed concurrently. We need to access the newest version here.
auto file = file_mngr_->find(copy_ptr->definition_location.file); | ||
if (!file) | ||
throw std::runtime_error("Dependencies of a macro must be open right after parsing the macro."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see that it could happen.. Should I remove the condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am again thinking about a race condition or something like that...
|
||
void macro_cache::erase_cache_of_opencode(const std::string opencode_file_name) | ||
{ | ||
auto it = cache_.begin(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any concurrency concerns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function is currently called from the workspace, which does not have any concurrent usage, as far as I know
, ACTR(&*ptr.emplace("ACTR").first) | ||
, AREAD(&*ptr.emplace("AREAD").first) | ||
, AGO(&*ptr.emplace("AGO").first) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to match the actual initialization order.
, ACTR(&*ptr.emplace("ACTR").first) | |
, AREAD(&*ptr.emplace("AREAD").first) | |
, AGO(&*ptr.emplace("AGO").first) | |
, AGO(&*ptr.emplace("AGO").first) | |
, ACTR(&*ptr.emplace("ACTR").first) | |
, AREAD(&*ptr.emplace("AREAD").first) |
Co-authored-by: slavek-kucera <53339291+slavek-kucera@users.noreply.github.com>
Kudos, SonarCloud Quality Gate passed! |
🎉 This PR is included in version 0.14.0-beta.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 0.14.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Cache dependencies (macro and COPY files), so they are not parsed multiple times, if the user has not made any changes to them.