You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has been going around my head for a while, I'm not sure if it's possible, but want to get it written down just in case.
Problem: LINQ expressions come with lambda allocation and contextual type allocation costs, this means their performance isn't as good as writing imperative code.
Possible solution: Use Source Generators to find LINQ expressions that evaluate to known language-ext monadic types. Replace the LINQ expression with an 'unrolled' version that runs imperatively. It won't remove all lambda usage, but would significantly reduce it.
The text was updated successfully, but these errors were encountered:
They can have the same constructors and operations on them as Aff and Eff, but they can only be compiled, not run directly.
We could then implement all the operations (Map, Bind, Filter...) by building expressions.
It has the following benefits,
Elimination of all lambda allocations, we could rewrite them away
Other smart rewriting rules (not that I understand or know how to implement any of them), like those performed by GHC, could be applied to the expression tree
Would look just like the standard Aff and Eff usage, but would (in my head) perform better.
There is nothing like this, (that I know about, besides the linq optimizers for IEnumerable) and so might be a real feature
It has the following negatives,
Library code maintenance, I had a quick go at implementing Map at the expression level and it was a bit like inception and I wanted to rest my brain
Expression quirks could cause many issues, which would then also increase the maintenance cost. All I know is that the majority of bugs registered against EfCore relate to Expressions and trying to write executable code at runtime.
This has been going around my head for a while, I'm not sure if it's possible, but want to get it written down just in case.
Problem: LINQ expressions come with lambda allocation and contextual type allocation costs, this means their performance isn't as good as writing imperative code.
Possible solution: Use Source Generators to find LINQ expressions that evaluate to known language-ext monadic types. Replace the LINQ expression with an 'unrolled' version that runs imperatively. It won't remove all lambda usage, but would significantly reduce it.
The text was updated successfully, but these errors were encountered: