{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/10378","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/10378/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/10378/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/10378/events","html_url":"https://github.com/dotnet/roslyn/issues/10378","id":146414049,"number":10378,"title":"State / Direction of C# as a High-Performance Language","user":{"login":"ilexp","id":14859411,"avatar_url":"https://avatars.githubusercontent.com/u/14859411?v=3","gravatar_id":"","url":"https://api.github.com/users/ilexp","html_url":"https://github.com/ilexp","followers_url":"https://api.github.com/users/ilexp/followers","following_url":"https://api.github.com/users/ilexp/following{/other_user}","gists_url":"https://api.github.com/users/ilexp/gists{/gist_id}","starred_url":"https://api.github.com/users/ilexp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilexp/subscriptions","organizations_url":"https://api.github.com/users/ilexp/orgs","repos_url":"https://api.github.com/users/ilexp/repos","events_url":"https://api.github.com/users/ilexp/events{/privacy}","received_events_url":"https://api.github.com/users/ilexp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Language%20Design","name":"Area-Language Design","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Discussion","name":"Discussion","color":"fbca04"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Language-C%23","name":"Language-C#","color":"207de5"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Tenet-Performance","name":"Tenet-Performance","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":136,"created_at":"2016-04-06T19:47:10Z","updated_at":"2016-09-16T00:37:16Z","closed_at":null,"body":"I've been following recent development of C# as a language and it seems that there is a strong focus on providing the means to write code more efficiently. This is definitely neat. But what about providing ways to write more efficient code?\r\n\r\nFor context, I'm using C# mostly for game development (as in \"lowlevel / from scratch\") which has a habit of gladly abandoning the usual ways of safe code design for that 0.1% of the bottleneck code in favor of maximum efficiency. Unfortunately, there are cases where C# gets in the way of that last bit of optimization.\r\n\r\n**Issues related to this:**\r\n\r\n- Ref returns / ref locals: Issue #118 \r\n- Slicing: Issue #120 \r\n- Array views of blittable data types: [CoreCLR Issue 1015](https://github.com/dotnet/coreclr/issues/1015)\r\n- Generic API for unsafe read / write: [CoreFx Issue 5474](https://github.com/dotnet/corefx/issues/5474)\r\n- Support for SSE4 Intrinsics: [CoreFx Issue 2209](https://github.com/dotnet/corefx/issues/2209)\r\n- Efficient unmanaged memory operations: [CoreCLR Issue 916](https://github.com/dotnet/coreclr/issues/916)\r\n- Vector shuffling SIMD operations: [CoreFx Issue 1168](https://github.com/dotnet/corefx/issues/1168)\r\n- Handling overlapped explicit FieldOffsets in structs: Issue #10319 and #7323\r\n- Extended JIT time constants: [CoreCLR Issue 2591](https://github.com/dotnet/coreclr/issues/2591)\r\n- Extended Compile time constants: Issue #10972 \r\n- Extended unsafe generics: Issues #3208 and #3210\r\n- PrimitiveValueType and Generic Pointers: Issue #2209 \r\n- Custom memory allocations: [CoreCLR Issue 1235](https://github.com/dotnet/coreclr/issues/1235)\r\n- _There are probably more - please share them in a comment_\r\n\r\n**Other sentiments regarding this:**\r\n\r\n- The only way to improve / guarantee memory locality right now seems to be putting the data into an array of structs. There are scenarios where this is a bit impractical. Are there ways to handle this with classes?\r\n- Language support for object pooling / limited control over what exactly \"new\" does for a given class / reference type.\r\n- A way to instantiate a reference type \"within scope\", making cleaning it up more efficient by somehow providing the GC with the extra knowledge about an explicit / intended lifespan.\r\n- _Please share your own in a comment_\r\n\r\nThis is probably more of a broader discussion, but I guess my core question is: **Is there a general roadmap** regarding potential improvements for performance-focused code in C#?"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/247491983","html_url":"https://github.com/dotnet/roslyn/issues/10378#issuecomment-247491983","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/10378","id":247491983,"user":{"login":"chrisaut","id":8252355,"avatar_url":"https://avatars.githubusercontent.com/u/8252355?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisaut","html_url":"https://github.com/chrisaut","followers_url":"https://api.github.com/users/chrisaut/followers","following_url":"https://api.github.com/users/chrisaut/following{/other_user}","gists_url":"https://api.github.com/users/chrisaut/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisaut/subscriptions","organizations_url":"https://api.github.com/users/chrisaut/orgs","repos_url":"https://api.github.com/users/chrisaut/repos","events_url":"https://api.github.com/users/chrisaut/events{/privacy}","received_events_url":"https://api.github.com/users/chrisaut/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T00:37:16Z","updated_at":"2016-09-16T00:37:16Z","body":"@antiufo this looks very very nice (disclaimer, I haven't actually tried it).\r\n\r\nBut I fear it will reach a very limited audience being maintained as a separate tool. Do you have any plans to propose/integrate all or parts of this into the \"mainstream\" compiler here?\r\n\r\nAnything you learned from it that would suggests it cannot/should not be done in the general case?"}}
{"actor":{"display_login":"chrisaut"}}