-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Move GetCurrentProcessId interop for Browser to managed #39367
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
Conversation
It returns constant all the time
|
How much does this save? Is it really worth it to be doing micro-optimizations like this? |
|
@jkotas it does not save much but I'd rather have these constants under our control and not depend on Emscripten |
| return new OperatingSystem(PlatformID.Other, new Version(1, 0, 0, 0)); | ||
| } | ||
|
|
||
| private static int GetCurrentProcessId() => (int)Interop.GetCurrentProcessId(); |
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 is the one and only place Interop.GetCurrentProcessId is used. Hardcode 42 here instead of going through extra layer of indirection?
It would match the hardcoding that we are doing for the other properties above. The other properties are not going through extra layer of indirection either.
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.
Good suggestion (not sure why I missed that)
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.
@jkotas looking at the build failure I know now why it was done this way. There are direct calls to Interop.GetCurrentProcessId within Microsoft.Diagnostics.Tracing.EventSource project. Are you ok with revert of the last commit?
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 have pushed commit that should fix the EventSource build break
* Move GetCurrentProcessId for Browser to managed It returns constant all the time * Remove redundant indirection * Fix EventSource build break Co-authored-by: Jan Kotas <[email protected]>
It returns constant all the time