Giter Site home page Giter Site logo

Comments (4)

 avatar commented on July 19, 2024

Well Lwt.wakeup_later is the same as Lwt.wakeup if not called inside another Lwt.wakeup or Lwt.wakeup_later.

Note that calling Lwt_react.E.next in a loop is a very bad idea. I didn't realized it at first when I wrote it but it can destroy performances.

from lwt.

mfp avatar mfp commented on July 19, 2024

On Fri, May 02, 2014 at 01:19:48AM -0700, Jérémie Dimino wrote:

Well Lwt.wakeup_later is the same as Lwt.wakeup if not called inside another Lwt.wakeup or Lwt.wakeup_later.

Note that calling Lwt_react.E.next in a loop is a very bad idea. I didn't realized it at first when I wrote it but it can destroy performances.

Could you expand a bit on that? Is it because of the use of React.E.once?

On top of that and on second thought, Lwt_react.E.next is also treacherous
because it looks like Lwt_stream.next and thus invites to use it in a loop to
get all the occurrences, but you'll lose some if there are context switches in
the middle.

So it is probably better to leave it as is and instead add some words of
warning in the docs along with a suggestion to use Lwt_react.E.to_stream +
Lwt_stream.next instead.

Mauricio Fernández

from lwt.

 avatar commented on July 19, 2024

Could you expand a bit on that? Is it because of the use of React.E.once?

Yes. Some weak array in react might grow quite a lot. I observed this a long time ago in a gtk program using it. The interface was getting slower and slower because of it.

On top of that and on second thought, Lwt_react.E.next is also treacherous
because it looks like Lwt_stream.next and thus invites to use it in a loop to
get all the occurrences, but you'll lose some if there are context switches in
the middle.

Definitely

So it is probably better to leave it as is and instead add some words of
warning in the docs along with a suggestion to use Lwt_react.E.to_stream +
Lwt_stream.next instead.

fine by me

from lwt.

rneswold avatar rneswold commented on July 19, 2024

So it is probably better to leave it as is and instead add some words of warning in the docs along with a suggestion to use Lwt_react.E.to_stream + Lwt_stream.next instead.

Does Lwt_react.E.to_stream guarantee it won't drop events if there are context switches? If so, the docs should reflect that, too.

from lwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.