calmm-js / karet.util

Utilities for working with Karet
MIT License
20 stars 5 forks source link

Some karet.util functions always return observables #33

Closed rikutiira closed 5 years ago

rikutiira commented 6 years ago

Most functions under Kefir section return observables no matter what their input is.

It's especially troublesome for very generic type of functions like U.when or U.ifElse which are likely to be used extensively throughout your codebase. They are usually better alternatives to R.when and R.ifElse due to them working with values instead of functions.

I'm doing some optimization for our app, and this has turned out to be one of the biggest peformance issues for us. It's especially problematic for large tables which use generic components like inputs or dropdowns which use the functions grouped under Kefir, causing slowness due to thousands or tens of thousands of Kefir subscribers.

Would it be okay to make a PR so that these functions will not return observables unless needed? Conditionals should be quite straightforward but perhaps some combinators need some extra thinking.

polytypic commented 5 years ago

Hmm... Does this relate / compare to #28?

rikutiira commented 5 years ago

Yeah, the fixes there should be sufficient to fix the issues mentioned above 👍

polytypic commented 5 years ago

Released 0.19.0