⚡ Sangsakala Proxy 🏠 Home
Skip to content

Improve Stream efficency #191

Open
Open

Description

@jbgi

Stream is rather slow, we should probably switch to an implementation based on a fold algebra with fusion whenever possible.

Activity

  1. jbgi commented on Sep 8, 2015

    @jbgi
    MemberAuthor

    https://www.cs.ox.ac.uk/ralf.hinze/publications/IFL10.pdf looks like a good read on the subject.
    also scala/slip#17 may be of interest.

  2. clinuxrulz commented on Feb 1, 2016

    @clinuxrulz
    Contributor

    Does anyone have a good benchmark for Streams?
    Stream fusion looks very much like coroutines, but I'm guessing there is more to it.

  3. jbgi commented on Feb 15, 2016

    @jbgi
    MemberAuthor

    A easy first step to improve perf would be to implement this change: scalaz/scalaz#1104

  4. jbgi commented on Mar 10, 2016

    @jbgi
    MemberAuthor
  5. jbgi commented on Mar 13, 2016

    @jbgi
    MemberAuthor

    initial experiment show good results based on Mu/Nu lists from above. If no objection I will try to put something together. @clinuxrulz did you work on a design for stream fusion?

  6. clinuxrulz commented on Mar 13, 2016

    @clinuxrulz
    Contributor

    No. I've been too busy at work unfortunately. I have nothing to contribute, you go ahead with your implementation.

  7. clinuxrulz commented on Apr 3, 2016

    @clinuxrulz
    Contributor

    I haven't worked out how to do stream fusion in Java yet.

    However I've got an implementation based on a stackless Coroutine with re-associated binds that emits values.

    which is more or less like this in haskell

    data StepF a next
      = Emit a next
      | Bind (forall b r. (Stream b -> (b -> Stream a) -> r) -> r)
    
    newtype Stream2 a = Stream2 (Free (StepF a) Unit)
    

    Heres the code:

    https://github.com/clinuxrulz/functionaljava/blob/stream/core/src/main/java/fj/data/Stream2.java

    I just need benchmarks to see if I've helped or hindered the situation.

  8. dimitarg commented on Jan 9, 2017

    @dimitarg

    I think quite some work was done in RxJava2 on operator fusion, it might be interesting to whoever takes on this issue.
    https://www.google.bg/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=rxjava%20operator%20fusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions