Re: Link.js v0.2.9
Reply #124 –
Hmm, it'd be hard to tell where exactly 1.5 is failing if it's Link, because that's purely a JS thing. Link should be stable even though it's still in development, the only thing I can foresee is that creating new link contexts each time could be the culprit:
// this:
for (var i = 0; i < 1000; ++i) Link(array).filter().map().whatever().each();
// versus this:
var l = Link(array).filter().map().whatever();
for (var i = 0; i < 1000; ++i) l.each();
The top code may use more memory more frequently than the bottom code. What it *might* be is Sphere running out of JS memory in certain spikes, even if it's GC'ing it perfectly. It could be that at some moments it doesn't GC in time and breaches the max memory. What kind of crashes are you experiencing? Crash to desktop or is there an actual error message?
Edit:
I'm having the hardest time trying to implement a string .split method in this lazy format. The issue I'm having is splitting the last word. Take this example: "Hi how are you?".split(" "). It should split into the 4 words: "Hi" "how" "are" "you?", but once Link sees the '?' it stops execution at that point since it reached the end of the road. I only get back the first 3 of the 4 words. In a lazy context there is no easy way of detecting the end of the road. I could run the first n-1 items, then on the last item, item n, run a special condition saying you reached the end, and split there. But that's great until you start filtering things out. Then the true end position has changed, it might no longer be at the end of the originating array. I'll have to rethink my lazy strategy to account for this inconvenience.
I might even have to rewrite the entire library.