Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #54 from doug-martin/master
Browse files Browse the repository at this point in the history
v0.2.9 0.2.9
  • Loading branch information
doug-martin committed Feb 15, 2014
2 parents 201bcd5 + 5500104 commit a9ab070
Show file tree
Hide file tree
Showing 13 changed files with 804 additions and 440 deletions.
6 changes: 6 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.2.9

* Increased `comb.Promise` performance
* Benchmark before `~10.5 sec` now `~6.8 sec`
* Added new `comb.array.partition`

# 0.2.8

* Fixed memory leak in promise.
Expand Down
4 changes: 2 additions & 2 deletions benchmark/promise.benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function runComb() {
while (++i < 100000) {
p = p.chain(function () {
return i;
}, console.log);
});
}
return p.chain(function () {
console.log("%d MB", (process.memoryUsage().rss / 1024 / 1024));
Expand All @@ -24,7 +24,7 @@ function runQ() {
while (++i < 100000) {
p = p.then(function () {
return i;
}, console.log);
});
}
p.then(function () {
console.log("%d MB", (process.memoryUsage().rss / 1024 / 1024));
Expand Down
352 changes: 206 additions & 146 deletions docs-md/coverage.html

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions docs/History.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@



<h1>0.2.9</h1>
<ul>
<li>Increased <code>comb.Promise</code> performance<ul>
<li>Benchmark before <code>~10.5 sec</code> now <code>~6.8 sec</code></li>
<li>Added new <code>comb.array.partition</code></li>
</ul>
</li>
</ul>
<h1>0.2.8</h1>
<ul>
<li>Fixed memory leak in promise.</li>
Expand Down
35 changes: 27 additions & 8 deletions docs/comb_Promise.html
Original file line number Diff line number Diff line change
Expand Up @@ -1174,18 +1174,37 @@ <h3>
<pre class="prettyprint linenums lang-js">
function (){
var ret = {
chain: this.chain.bind(this),
chainBoth: this.chainBoth.bind(this),
promise: function () {
return ret;
}
};
forEach([&quot;addCallback&quot;, &quot;addErrback&quot;, &quot;then&quot;, &quot;both&quot;, &quot;classic&quot;], function (action) {
ret[action] = function () {
spreadArgs(this[action], arguments, this);
return ret;
}.bind(this);
}, this);
var self = this;
ret[&quot;chain&quot;] = function () {
return spreadArgs(self[&quot;chain&quot;], arguments, self);
};
ret[&quot;chainBoth&quot;] = function () {
return spreadArgs(self[&quot;chainBoth&quot;], arguments, self);
};
ret[&quot;addCallback&quot;] = function () {
spreadArgs(self[&quot;addCallback&quot;], arguments, self);
return ret;
};
ret[&quot;addErrback&quot;] = function () {
spreadArgs(self[&quot;addErrback&quot;], arguments, self);
return ret;
};
ret[&quot;then&quot;] = function () {
spreadArgs(self[&quot;then&quot;], arguments, self);
return ret;
};
ret[&quot;both&quot;] = function () {
spreadArgs(self[&quot;both&quot;], arguments, self);
return ret;
};
ret[&quot;classic&quot;] = function () {
spreadArgs(self[&quot;classic&quot;], arguments, self);
return ret;
};
return ret;

}
Expand Down
81 changes: 81 additions & 0 deletions docs/comb_array.html
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,21 @@
multiply
</a></li>

<li><a href="./comb_array.html#.partition">

<span class="label label-info">S</span>


<span class="label label-label">F</span>



<span class="label label-success">P</span>


partition
</a></li>

<li><a href="./comb_array.html#.permutations">

<span class="label label-info">S</span>
Expand Down Expand Up @@ -1383,6 +1398,72 @@ <h3>



<a name=".partition"></a>
<h3>
partition

<span class="label label-info">Static</span>


<span class="label label-label">Function</span>



<span class="label label-success">Public</span>


</h3>

<hr/>
<em>Defined base/array.js</em>

<p><p>Paritition an array.</p>
<pre class='prettyprint linenums lang-js'><code>var arr = [1,2,3,4,5];

comb.array.partition(arr, 1); //[[1], [2], [3], [4], [5]]
comb.array.partition(arr, 2); //[[1,2], [3,4], [5]]
comb.array.partition(arr, 3); //[[1,2,3], [4,5]]

comb.array.partition(arr); //[[1, 2, 3, 4, 5]]
comb.array.partition(arr, 0); //[[1, 2, 3, 4, 5]]</code></pre>
</p>


<em>Arguments</em>
<ul>

<li> <em>array</em> : </li>

<li> <em>partitionSize</em> : </li>

</ul>


<em>Returns</em>
<ul>

<li> <code>Array</code> </li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">
function (array,partitionSize){
partitionSize = partitionSize || array.length;
var ret = [];
for (var i = 0, l = array.length; i &amp;lt; l; i += partitionSize) {
ret.push(array.slice(i, i + partitionSize));
}
return ret;
}
</pre>




<a name=".permutations"></a>
<h3>
permutations
Expand Down
Loading

0 comments on commit a9ab070

Please sign in to comment.