Skip to content

Commit

Permalink
Merge pull request #36 from doug-martin/master
Browse files Browse the repository at this point in the history
v0.1.3
  • Loading branch information
doug-martin committed May 25, 2013
2 parents ff8d99b + 905b0d5 commit 49bc7e3
Show file tree
Hide file tree
Showing 6 changed files with 828 additions and 788 deletions.
4 changes: 4 additions & 0 deletions docs/History.html
Expand Up @@ -176,6 +176,10 @@



<h1>v0.1.3 / 2012-05-24</h1>
<ul>
<li>Fixed memory leak with FactHashes for the agendas</li>
</ul>
<h1>v0.1.2 / 2012-05-24</h1>
<ul>
<li>Removed unneeded calls to <code>.then</code> to address performance degredation (#30)</li>
Expand Down
4 changes: 4 additions & 0 deletions history.md
@@ -1,3 +1,7 @@
#v0.1.3 / 2012-05-24

* Fixed memory leak with FactHashes for the agendas

#v0.1.2 / 2012-05-24

* Removed unneeded calls to `.then` to address performance degredation (#30)
Expand Down
16 changes: 16 additions & 0 deletions lib/index.js
Expand Up @@ -74,13 +74,29 @@ var FactHash = declare({
return this.memoryValues[indexOf(this.memory, k)];
},

__compact: function () {
var oldM = this.memory.slice(0),
oldMv = this.memoryValues.slice(0),
l = oldMv.length,
m = this.memory = [],
mv = this.memoryValues = [],
oldMemoryValue;
for (var i = 0; i < l; i++) {
oldMemoryValue = oldMv[i];
if (oldMemoryValue.length !== 0) {
mv[m.push(oldM[i]) - 1] = oldMemoryValue;
}
}
},

remove: function (v) {
var facts = v.match.facts, j = facts.length - 1, mv = this.memoryValues, m = this.memory;
for (; j >= 0; j--) {
var i = indexOf(m, facts[j]);
var arr = mv[i], index = indexOf(arr, v);
arr.splice(index, 1);
}
this.__compact();
},

insert: function (insert) {
Expand Down

0 comments on commit 49bc7e3

Please sign in to comment.