{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefxlab/issues/768","repository_url":"https://api.github.com/repos/dotnet/corefxlab","labels_url":"https://api.github.com/repos/dotnet/corefxlab/issues/768/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefxlab/issues/768/comments","events_url":"https://api.github.com/repos/dotnet/corefxlab/issues/768/events","html_url":"https://github.com/dotnet/corefxlab/pull/768","id":172311805,"number":768,"title":"Modified the FormattingData class to allow for parsing. Full support for cultural specific parsing.","user":{"login":"jonfortescue","id":13228069,"avatar_url":"https://avatars.githubusercontent.com/u/13228069?v=3","gravatar_id":"","url":"https://api.github.com/users/jonfortescue","html_url":"https://github.com/jonfortescue","followers_url":"https://api.github.com/users/jonfortescue/followers","following_url":"https://api.github.com/users/jonfortescue/following{/other_user}","gists_url":"https://api.github.com/users/jonfortescue/gists{/gist_id}","starred_url":"https://api.github.com/users/jonfortescue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonfortescue/subscriptions","organizations_url":"https://api.github.com/users/jonfortescue/orgs","repos_url":"https://api.github.com/users/jonfortescue/repos","events_url":"https://api.github.com/users/jonfortescue/events{/privacy}","received_events_url":"https://api.github.com/users/jonfortescue/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefxlab/labels/cla-already-signed","name":"cla-already-signed","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"KrzysztofCwalina","id":9724236,"avatar_url":"https://avatars.githubusercontent.com/u/9724236?v=3","gravatar_id":"","url":"https://api.github.com/users/KrzysztofCwalina","html_url":"https://github.com/KrzysztofCwalina","followers_url":"https://api.github.com/users/KrzysztofCwalina/followers","following_url":"https://api.github.com/users/KrzysztofCwalina/following{/other_user}","gists_url":"https://api.github.com/users/KrzysztofCwalina/gists{/gist_id}","starred_url":"https://api.github.com/users/KrzysztofCwalina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrzysztofCwalina/subscriptions","organizations_url":"https://api.github.com/users/KrzysztofCwalina/orgs","repos_url":"https://api.github.com/users/KrzysztofCwalina/repos","events_url":"https://api.github.com/users/KrzysztofCwalina/events{/privacy}","received_events_url":"https://api.github.com/users/KrzysztofCwalina/received_events","type":"User","site_admin":false},"assignees":[{"login":"KrzysztofCwalina","id":9724236,"avatar_url":"https://avatars.githubusercontent.com/u/9724236?v=3","gravatar_id":"","url":"https://api.github.com/users/KrzysztofCwalina","html_url":"https://github.com/KrzysztofCwalina","followers_url":"https://api.github.com/users/KrzysztofCwalina/followers","following_url":"https://api.github.com/users/KrzysztofCwalina/following{/other_user}","gists_url":"https://api.github.com/users/KrzysztofCwalina/gists{/gist_id}","starred_url":"https://api.github.com/users/KrzysztofCwalina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrzysztofCwalina/subscriptions","organizations_url":"https://api.github.com/users/KrzysztofCwalina/orgs","repos_url":"https://api.github.com/users/KrzysztofCwalina/repos","events_url":"https://api.github.com/users/KrzysztofCwalina/events{/privacy}","received_events_url":"https://api.github.com/users/KrzysztofCwalina/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-08-21T08:54:17Z","updated_at":"2016-08-23T17:43:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dotnet/corefxlab/pulls/768","html_url":"https://github.com/dotnet/corefxlab/pull/768","diff_url":"https://github.com/dotnet/corefxlab/pull/768.diff","patch_url":"https://github.com/dotnet/corefxlab/pull/768.patch"},"body":"This is a big PR, so apologies in advance.\r\n\r\nOverview:\r\n* Added a new data structure to `FormattingData`: a parsing [trie](https://en.wikipedia.org/wiki/Trie) (or prefix tree). This structure serves as the inverse of the formatting map that is provided to `FormattingData`.\r\n* As of this commit, this structure is allocated when the `FormattingData` object is created, which means that there is an expensive upfront cost. However, since the trie is navigated using binary search, lookup is extremely cheap, which means we trade off that upfront cost for very performant parsing.\r\n    * This means it is optimized for the webserver scenario (initialize my encoding, then parse a bunch of requests)\r\n    * However, there are obviously other scenarios that would benefit from slower parsing in favor of not having any (or as much of) an upfront cost. These optimizations will come in future pull requests. (Currently, some basic flags exist for a future \"lazy construction\" option.)\r\n* In order to parse, the `FormattingData` structure acts as a state machine. You pass it bytes, and it tells you to continue passing it bytes until it successfully parses a code unit, at which point it returns the value of that code unit.\r\n* The structure has the potential to allow special parsing rules in the future for encodings that require them. However, as of now the parsing structure has a few basic assumptions:\r\n    * Any culture/encoding is based on a decimal 0-9 digit system\r\n    * An culture/encoding can be basically understood as a sequence of bytes read from left to right\r\n    * Code units in every culture/encoding are unambiguous\r\n* If any of these assumptions are violated by a culture/encoding, special casing and a state flag would need to be introduced\r\n* I've added tests for an Invariant UTF-8 lookalike and a simple Thai-based UTF-8 encoding. All tests are passing, which shows just how versatile this structure is.\r\n* No perf testing has been done yet. Will investigate perf on Monday."},"comment":{"url":"https://api.github.com/repos/dotnet/corefxlab/issues/comments/241814555","html_url":"https://github.com/dotnet/corefxlab/pull/768#issuecomment-241814555","issue_url":"https://api.github.com/repos/dotnet/corefxlab/issues/768","id":241814555,"user":{"login":"KrzysztofCwalina","id":9724236,"avatar_url":"https://avatars.githubusercontent.com/u/9724236?v=3","gravatar_id":"","url":"https://api.github.com/users/KrzysztofCwalina","html_url":"https://github.com/KrzysztofCwalina","followers_url":"https://api.github.com/users/KrzysztofCwalina/followers","following_url":"https://api.github.com/users/KrzysztofCwalina/following{/other_user}","gists_url":"https://api.github.com/users/KrzysztofCwalina/gists{/gist_id}","starred_url":"https://api.github.com/users/KrzysztofCwalina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrzysztofCwalina/subscriptions","organizations_url":"https://api.github.com/users/KrzysztofCwalina/orgs","repos_url":"https://api.github.com/users/KrzysztofCwalina/repos","events_url":"https://api.github.com/users/KrzysztofCwalina/events{/privacy}","received_events_url":"https://api.github.com/users/KrzysztofCwalina/received_events","type":"User","site_admin":false},"created_at":"2016-08-23T17:43:45Z","updated_at":"2016-08-23T17:43:45Z","body":">         public void ParseUtf8ByteArrayToDecimal(string text, bool expectSuccess, int index, decimal expectedValue, int expectedBytesConsumed)\r\n\r\nWould it make sense to have the non-generated tests in a separate cs file instead of using the template?\r\n\r\n---\r\nRefers to: tests/System.Text.Primitives.Tests/ParserTests.tt:496 in d647eb0. [](commit_id = d647eb06cc254196982ff46936ee54dd68d7a212, deletion_comment = False)"}}
{"actor":{"display_login":"KrzysztofCwalina"}}