{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1570","repository_url":"https://api.github.com/repos/Microsoft/visualfsharp","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1570/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1570/comments","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1570/events","html_url":"https://github.com/Microsoft/visualfsharp/pull/1570","id":179727402,"number":1570,"title":"[WIP] Seq Composer","user":{"login":"manofstick","id":2093966,"avatar_url":"https://avatars.githubusercontent.com/u/2093966?v=3","gravatar_id":"","url":"https://api.github.com/users/manofstick","html_url":"https://github.com/manofstick","followers_url":"https://api.github.com/users/manofstick/followers","following_url":"https://api.github.com/users/manofstick/following{/other_user}","gists_url":"https://api.github.com/users/manofstick/gists{/gist_id}","starred_url":"https://api.github.com/users/manofstick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manofstick/subscriptions","organizations_url":"https://api.github.com/users/manofstick/orgs","repos_url":"https://api.github.com/users/manofstick/repos","events_url":"https://api.github.com/users/manofstick/events{/privacy}","received_events_url":"https://api.github.com/users/manofstick/received_events","type":"User","site_admin":false},"labels":[{"id":197650126,"url":"https://api.github.com/repos/Microsoft/visualfsharp/labels/cla-already-signed","name":"cla-already-signed","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":57,"created_at":"2016-09-28T09:48:25Z","updated_at":"2016-11-06T05:48:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/1570","html_url":"https://github.com/Microsoft/visualfsharp/pull/1570","diff_url":"https://github.com/Microsoft/visualfsharp/pull/1570.diff","patch_url":"https://github.com/Microsoft/visualfsharp/pull/1570.patch"},"body":"A Seq replacement somewhat similar (but better!) performance to System.Linq extension methods. Will attempt to replicate all functionality under the new method, but not required. i.e. compatible with existing implementation. \n\n`Seq module` functions that produce `seq`s - will at least have a look at them all to determine if they can be reasonably moved over.\n- [ ] `allPairs`\n- [x] `append`\n- [ ] `cache`\n- [ ] `cast`\n- [x] `choose`\n- [ ] `chunkBySize`\n- [x] `collect`\n- [x] `concat`\n- [ ] `countBy`\n- [ ] `delay`\n- [x] `distinct`\n- [x] `distinctBy`\n- [ ] `splitInto`\n- [ ] `empty`\n- [x] `except`\n- [x] `filter`\n- [x] `where`\n- [ ] `groupBy`\n- [x] `indexed`\n- [x] `init`\n- [x] `initInfinite`\n- [x] `map`\n- [x] `map2`\n- [x] `map3`\n- [ ] `mapFold`\n- [ ] `mapFoldBack`\n- [x] `mapi`\n- [x] `mapi2`\n- [x] `ofArray`\n- [ ] `ofList`\n- [x] `pairwise`\n- [x] `permute`\n- [ ] `readonly`\n- [ ] `replicate`\n- [x] `rev`\n- [x] `scan`\n- [ ] `scanBack`\n- [ ] `singleton`\n- [x] `skip`\n- [x] `skipWhile`\n- [x] `sort`\n- [x] `sortWith`\n- [x] `sortBy`\n- [x] `sortDescending`\n- [x] `sortByDescending`\n- [x] `tail`\n- [x] `take`\n- [x] `takeWhile`\n- [x] `truncate`\n- [x] `unfold`\n- [ ] `windowed`\n- [x] `zip`\n- [x] `zip3`\n\nSeq functions that consume `seq`s (undecided if will provide special implementations or not, as performance is really improved within the chain of the `seq`s rather than just the tail. But maybe.)\n- [x] `average`\n- [x] `averageBy`\n- [x] `compareWith`\n- [x] `contains`\n- [x] `exists`\n- [x] `exists2`\n- [x] `find`\n- [ ] `findBack`\n- [x] `findIndex`\n- [ ] `findIndexBack`\n- [x] `fold`\n- [x] `fold2`\n- [ ] `foldBack`\n- [ ] `foldBack2`\n- [x] `forall`\n- [x] `forall2`\n- [x] `head`\n- [x] `tryHead`\n- [x] `last`\n- [x] `tryLast`\n- [x] `exactlyOne`\n- [ ] `isEmpty`\n- [x] `item`\n- [x] `iter`\n- [x] `iteri`\n- [x] `iter2`\n- [x] `iteri2`\n- [ ] `length`\n- [x] `max`\n- [x] `maxBy`\n- [x] `min`\n- [x] `minBy`\n- [ ] `nth`\n- [x] `pick`\n- [x] `reduce`\n- [ ] `reduceBack`\n- [x] `sum`\n- [x] `sumBy`\n- [ ] `toArray`\n- [ ] `toList`\n- [x] `tryFind`\n- [ ] `tryFindBack`\n- [x] `tryFindIndex`\n- [x] `tryItem`\n- [ ] `tryFindIndexBack`\n- [x] `tryPick`\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/comments/258662166","html_url":"https://github.com/Microsoft/visualfsharp/pull/1570#issuecomment-258662166","issue_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1570","id":258662166,"user":{"login":"manofstick","id":2093966,"avatar_url":"https://avatars.githubusercontent.com/u/2093966?v=3","gravatar_id":"","url":"https://api.github.com/users/manofstick","html_url":"https://github.com/manofstick","followers_url":"https://api.github.com/users/manofstick/followers","following_url":"https://api.github.com/users/manofstick/following{/other_user}","gists_url":"https://api.github.com/users/manofstick/gists{/gist_id}","starred_url":"https://api.github.com/users/manofstick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manofstick/subscriptions","organizations_url":"https://api.github.com/users/manofstick/orgs","repos_url":"https://api.github.com/users/manofstick/repos","events_url":"https://api.github.com/users/manofstick/events{/privacy}","received_events_url":"https://api.github.com/users/manofstick/received_events","type":"User","site_admin":false},"created_at":"2016-11-06T05:48:05Z","updated_at":"2016-11-06T05:48:05Z","body":"@dsyme \r\n\r\nSome random bullet points:\r\n\r\n- I have no idea what your current release cycle is. I'm happy with this join in whenever be it 4.2 or 5.0. Obviously nicer to be sooner rather than later, but later rather than never is preferable! We have tried to be minimal around surface area changes; if we're planning on later rather than sooner I would like to expand the surface area so that we can natively deal with the composable types. This allows inlining of functions like `map` to make tighter code, and inlining of functions that use `HashIdentity.Structural` like groupBy so we can have non-boxing operations of structs keys and efficient tuples. \r\n\r\n- Yes, we have tried to manage the casting. By just making a single casting point, and the fallback being that we are always seq<> compatible I think is really the differentiating point between this and say Nessos's Stream library (as well as obviously making the explicit point of being api equivalent to existing Seq, especially under exception conditions).\r\n\r\n- Small collections under similar piping to our rolling example perform better than the current library, although not a well as linq. A bit of an example with small Seq's [is here](https://github.com/manofstick/visualfsharp/pull/1#issuecomment-251061058) (although we perform a little worse than that now due to slightly heavier factory construction). I believe the only cases where we are slower is when a raw IEnumerable<> being used with one of the Seq aggregation functions. I'll endeavour to create a better summary page. [This is](https://gist.github.com/manofstick/b685a5acfe99f39f44c9cf06b89d2fe2) my starting point, but I haven't progressed it for a while due to trying to just finish the code off.\r\n\r\n- We have tried to implement all the idiosyncrasies of the existing library. This means that replicate exceptions under the same conditions. i.e. like \r\n\r\n        Seq.init 10 id\r\n        |> Seq.take 100\r\n        |> Seq.takeWhile (fun x -> x < 5)\r\n        |> Seq.sum\r\n\r\n    succeeds with 10 as the result. Whereas \r\n\r\n        Seq.init 10 id\r\n        |> Seq.takeWhile (fun x -> x < 5)\r\n        |> Seq.take 100\r\n        |> Seq.sum\r\n\r\n     throws an exception.\r\n\r\n- That is is critical code is both a blessing and a curse. It is a blessing in that the fact that the build still builds correctly (let alone the existing test suite) means that any surface bugs (and possibly mid-level) probably don't exist! But yes, a lot of code. A lot of damn code.\r\n\r\n- Personally at work where we have a fairly large f# code base but we have removed pretty much all Seq library code (due to poor performance). So unfortunately that isn't going to be any good at providing testing within a non-f# compiler code base. Maybe anyone listening in can try. Not that such are exhaustive tests of course, but helpful non the less.\r\n\r\n- It's alright for you to tune out, you can't juggle all balls at once, but maybe someone else should be monitoring what's going on? Anyway I am a bit of a trouble make aren't I? I'm just not afraid of making fairly fundamental changes to code! (well that's not really true, I do feel afraid to some degree, but I feel more like a rock climber with safety harness...) But Seq has been super annoying, given that it doesn't even perform as well as the linq-to-objects library. It really almost turned me off using f# - i.e. it was one of the first things I used, coming from c# linq, and  I just thought that f# performance would always just be poor. I'm glad I managed to get past that, but I can imagine that being a stopping point for some in their exploration of f#. So here we have chance to leapfrog the linq-to-objects implementation (especially if we can incorporate the inline stuff).\r\n"}}
{"actor":{"display_login":"manofstick"}}