-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Compiler: Add "Top 10 slowest modules" to --stats output #12942
base: master
Are you sure you want to change the base?
Conversation
slice.update(module_idx) do |unit| | ||
unit.compilation_time = unit_info["time"].as_f.seconds | ||
unit | ||
end |
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.
unit
is a reference, so I believe direct mutation works and there is no need to do it like a value (unless there is some complication with forking)
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.
Pages in forked processes are copy-on-write by default. And the pages allocated by bdwgc are not marked as MEM_SHARED
(probably for good reason, I'd wager). That is why this pipe mechanism is used, as a safe vehicle to share memory.
Edit: Sorry, mistook the question; Yes - in this context we are in the parent thread, so mutating should be fine here.
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.
Are you still going to address this?
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.
@HertzDevil No, make any changes you see fit.
@@ -631,6 +652,7 @@ module Crystal | |||
getter original_name | |||
getter llvm_mod | |||
getter? reused_previous_compilation = false | |||
property compilation_time : Time::Span = Time::Span::ZERO |
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.
This should probably be a property!
instead
May be useful for spotting modules in large apps that may benefit from being broken up in order to improve build times, etc.
Example output: