Comments (6)
Issue moved to pelotom/burrido #2 via ZenHub
from immutagen.
Doing concat on normal js Array has quadratic complexity,
Hm, I don't think you're right about that. Concatenating 2 arrays of length n and m would be O(n + m), but appending a single element to the end of an array, as we're doing here, is just O(n). Using a cons-list for the history would make appending an element constant time, but because of the map
the overall complexity of a single yield
would remain O(n).
from immutagen.
Correct, so concat will be O(n) + map O(n) so single yield will stay O(n), i.e. we can't fix it.
But I still think that, it should be noted in readme, as users of immutagen
and burrido
might not be aware of this.
from immutagen.
Quoting from the current README:
Note also that there is inherent inefficiency in this technique, because every
yield
expression requires replaying the entire history up to that point. For this reason it's advisable to keep expensive computations to a minimum inside immutable generators, particularly as the number ofyield
expressions in the generator grows. Even if there isn't a lot of expensive computation, the runtime complexity will be quadratic in the number ofyield
expressions to be evaluated, so be careful.
Is that not sufficiently clear?
from immutagen.
didn't saw that in "burrido"
from immutagen.
I'd be happy to review a PR on the burrido repo that adds wording to that effect.
from immutagen.
Related Issues (3)
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 immutagen.