leonoel / missionary

A functional effect and streaming system for Clojure/Script
Eclipse Public License 2.0
636 stars 26 forks source link

Use goog.async.nextTick on CLJS #7

Closed lgrapenthin closed 5 years ago

lgrapenthin commented 5 years ago

https://google.github.io/closure-library/api/goog.async.nextTick.html

Its preferable over setTimeout, because setTimeout induces a 4ms delay.

leonoel commented 5 years ago

Could you elaborate on this ? setTimeout and g.a.nextTick don't have the same semantics, and we still need setTimeout for non-null delays. Are you suggesting we check null delays and use g.a.nextTick as an optimization in this case ? Why not complete synchronously instead ?

lgrapenthin commented 5 years ago

You are right, I completely misremembered/confused a few things about this in core.async. It appears core.async hasn't addressed the 4 ms problem directly, but they use a skiplist to squash a timeout if it happens less than 10ms after another. It might not be relevant here, feel free to close.