{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/14189","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/14189/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/14189/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/14189/events","html_url":"https://github.com/dotnet/corefx/issues/14189","id":193341574,"number":14189,"title":"API Proposal: S.M.Span<T> add Fill(T value)","user":{"login":"nietras","id":10798831,"avatar_url":"https://avatars.githubusercontent.com/u/10798831?v=3","gravatar_id":"","url":"https://api.github.com/users/nietras","html_url":"https://github.com/nietras","followers_url":"https://api.github.com/users/nietras/followers","following_url":"https://api.github.com/users/nietras/following{/other_user}","gists_url":"https://api.github.com/users/nietras/gists{/gist_id}","starred_url":"https://api.github.com/users/nietras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nietras/subscriptions","organizations_url":"https://api.github.com/users/nietras/orgs","repos_url":"https://api.github.com/users/nietras/repos","events_url":"https://api.github.com/users/nietras/events{/privacy}","received_events_url":"https://api.github.com/users/nietras/received_events","type":"User","site_admin":false},"labels":[{"id":163655927,"url":"https://api.github.com/repos/dotnet/corefx/labels/api-approved","name":"api-approved","color":"159818","default":false},{"id":174276033,"url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Runtime","name":"area-System.Runtime","color":"d4c5f9","default":false},{"id":145399958,"url":"https://api.github.com/repos/dotnet/corefx/labels/up%20for%20grabs","name":"up for grabs","color":"159818","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/4","html_url":"https://github.com/dotnet/corefx/milestone/4","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/4/labels","id":1248719,"number":4,"title":"1.2.0","description":".NET Core 1.2 Placeholder (next major release)\r\nhttps://github.com/dotnet/core/blob/master/roadmap.md","creator":{"login":"joshfree","id":1302850,"avatar_url":"https://avatars.githubusercontent.com/u/1302850?v=3","gravatar_id":"","url":"https://api.github.com/users/joshfree","html_url":"https://github.com/joshfree","followers_url":"https://api.github.com/users/joshfree/followers","following_url":"https://api.github.com/users/joshfree/following{/other_user}","gists_url":"https://api.github.com/users/joshfree/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfree/subscriptions","organizations_url":"https://api.github.com/users/joshfree/orgs","repos_url":"https://api.github.com/users/joshfree/repos","events_url":"https://api.github.com/users/joshfree/events{/privacy}","received_events_url":"https://api.github.com/users/joshfree/received_events","type":"User","site_admin":false},"open_issues":342,"closed_issues":3204,"state":"open","created_at":"2015-08-10T18:04:00Z","updated_at":"2016-12-09T22:28:43Z","due_on":null,"closed_at":null},"comments":13,"created_at":"2016-12-04T09:36:07Z","updated_at":"2016-12-09T22:39:44Z","closed_at":null,"body":"As discussed briefly in https://github.com/dotnet/corefx/issues/13427 I propose to add a `Fill(T value)` method to `Span<T>` to make span the goto place for safe and fast memory operations. \r\n\r\nThis is analoguous to the same method approved for arrays in https://github.com/dotnet/corefx/issues/6695 and added in https://github.com/dotnet/coreclr/pull/8137, https://github.com/dotnet/corert/pull/2259 but still lacking optimization https://github.com/dotnet/coreclr/issues/8290, perhaps `Array.Fill<T>` could forward to `Span<T>.Fill` in the future...\r\n\r\n### Rationale and Usage\r\nProvide a safe yet fast way of filling of any type of contiguous memory; managed or unmanaged.\r\n\r\n```csharp\r\nvar span = new Span<int>(array, 3, 10);\r\nspan.Fill(42);\r\n```\r\n\r\nThe argumentation for adding this is similar to `Array.Fill<T>`, but here with a wider use case, since this can be used with both managed and unmanaged memory:\r\n * To increase the efficiency of code doing this and prevent people from reinventing the wheel.\r\n * Allow performance optimizations depending on memory type and contents.\r\n\r\n### Proposed API\r\nAdd a single method `Fill(T value)` to the existing `Span<T>` API:\r\n```csharp\r\npublic class Span<T>\r\n{\r\n     public void Fill(T value);\r\n}\r\n```\r\n\r\n### Open Questions\r\nOpen question is whether this should be added as a member method or an extension method. I would argue for a member method, since this will depend on internal representation, and would perhaps allow for the JIT intrinsic version to do optimizations that a generic extension method can't. If that is a valid argument?\r\n\r\n@karelz @jkotas @omariom @benaadams @jamesqo "},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/266142950","html_url":"https://github.com/dotnet/corefx/issues/14189#issuecomment-266142950","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/14189","id":266142950,"user":{"login":"nietras","id":10798831,"avatar_url":"https://avatars.githubusercontent.com/u/10798831?v=3","gravatar_id":"","url":"https://api.github.com/users/nietras","html_url":"https://github.com/nietras","followers_url":"https://api.github.com/users/nietras/followers","following_url":"https://api.github.com/users/nietras/following{/other_user}","gists_url":"https://api.github.com/users/nietras/gists{/gist_id}","starred_url":"https://api.github.com/users/nietras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nietras/subscriptions","organizations_url":"https://api.github.com/users/nietras/orgs","repos_url":"https://api.github.com/users/nietras/repos","events_url":"https://api.github.com/users/nietras/events{/privacy}","received_events_url":"https://api.github.com/users/nietras/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T22:39:44Z","updated_at":"2016-12-09T22:39:44Z","body":"@karelz I hope to give it a shot, but again am waiting for the `Unsafe` additions. Otherwise, it seems @jkotas is ok with a functional commit, before an optimized commit."}}
{"actor":{"display_login":"nietras"}}