pineapplemachine / higher

Lazy and async higher-order functions in JavaScript.
Other
3 stars 0 forks source link

Investigate optimized implementations for single-length chains #162

Open pineapplemachine opened 6 years ago

pineapplemachine commented 6 years ago

In less jargony terms:

Higher is largely optimized for cases like seq.map(...).filter(...).something(...).array(), i.e. long chains of manipulation functions. However, this is only a subset of use cases. Many of the most common use cases will look more like seq.map(...).array(), i.e. a single-length chain.

It may be that detecting these cases and using a separate code path may produce significantly more performant code. However, whether this is actually true requires actual investigation. This task should be TODO after benchmark tools are in place.

If tests reveal that this is in fact a worthwhile optimization, then it should be implemented for the most common sequence types and possibly eventually for all types.