Comments (4)
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.
On Fri, May 02, 2014 at 01:19:48AM -0700, Jérémie Dimino wrote:
Well
Lwt.wakeup_later
is the same asLwt.wakeup
if not called inside anotherLwt.wakeup
orLwt.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.
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 likeLwt_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 useLwt_react.E.to_stream
+
Lwt_stream.next
instead.
fine by me
from lwt.
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)
- How to use Lwt_unix with OCaml 5 effects? HOT 3
- Exception printed in Lwt_stream.bounded_push#close documentation HOT 1
- Provide `Lwt.sleep` as a Unix-less function HOT 3
- Ppx_lwt docs link returns 404 error (since 5.4.0) HOT 1
- Drop support for OCaml < 4.08.0 HOT 4
- `src/unix/config/discover.exe` puts too much `-I` includes which can mislead the compiler
- EBADF from Lwt_process.with_* HOT 4
- Support `Lwt_process` in multi-domain settings HOT 1
- passing `env` in `Lwt_process` doesn't work on Windows HOT 1
- forking breaks lwt-io if happens after Lwt_main.run HOT 3
- memory consumption blowups in downstream projects using Lwt HOT 5
- Ocaml 5 build issue HOT 3
- Default Unix pool size (1000) is insane and dangerous
- SIGSEGV on OCaml 5 due to missing SA_ONSTACK HOT 2
- Clarify documentation of Lwt_stream.get_available
- Have a separate set of `Lwt_process.pread` that also return the process status HOT 2
- Documentation of `Lwt_stream.create` and `Lwt_stream.get`
- Need a way to share SIGCHLD with other libraries HOT 2
- Race in worker_loop HOT 1
- Library not found for `-llwt_unix_stubs` on macOS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lwt.