Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed uneeded calls to `.then` to address performance degredation (#30)
- Loading branch information
1 parent
ac9fe0d
commit 8aa530a
Showing
10 changed files
with
2,057 additions
and
1,979 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use strict"; | ||
var nools = require("../../"), | ||
defined = {}, | ||
constraints = [], | ||
COUNT = 5; | ||
|
||
for (var i = 0; i < COUNT; i++) { | ||
constraints.push([defined["Object" + i] = function (value) { | ||
this.name = value; | ||
}, "m" + i]); | ||
} | ||
|
||
|
||
var start = new Date().getTime(); | ||
|
||
var execCount = 0; | ||
|
||
var flow = nools.flow("Performance Test", function () { | ||
|
||
//find any message that starts with hello | ||
this.rule("Rule1", constraints, function () { | ||
|
||
execCount++; | ||
console.log("execCount: " + execCount); | ||
} | ||
); | ||
|
||
}); | ||
|
||
var session = flow.getSession(); | ||
|
||
for (var j = 0; j < COUNT; j++) { | ||
for (var k = 0; k < COUNT; k++) { | ||
session.assert(new defined["Object" + k](j + " " + k)); | ||
} | ||
} | ||
|
||
session.match(function (err) { | ||
if (err) { | ||
throw err; | ||
} | ||
var end = new Date().getTime(); | ||
var diff = end - start; | ||
console.log("elapsed: " + diff); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.