Skip to content

Conversation

@marek-safar
Copy link
Contributor

It returns constant all the time

It returns constant all the time
@jkotas
Copy link
Member

jkotas commented Jul 18, 2020

How much does this save? Is it really worth it to be doing micro-optimizations like this?

@marek-safar
Copy link
Contributor Author

@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();
Copy link
Member

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.

Copy link
Contributor Author

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)

Copy link
Contributor Author

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?

Copy link
Member

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

@jkotas jkotas merged commit 5bd0edf into dotnet:master Jul 31, 2020
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
* 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]>
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.Runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants