We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In my nools rule language file I have defined the following object:
define MyObject { id : '', value : 'NO_VALUE', parameters : { }, constructor : function(id, value, parameters) { this.id = id; this.value = value; this.parameters = parameters; } }
I have noticed that adding instances of these objects takes a notably long time. Executing the following testing code,
var _flow = this._nools.compile(noolsDSL, {name: "adaptationRules"}); var _MyObject = _flow.getDefined("MyObject"); var _currentSession = this._flow.getSession(); var addIntTime = Date.now() / 1000; for (var i = 1; i < 10000; i++) { _currentSession.assert(i); } console.log("Add 10000 integers time: "+(Date.now() / 1000 - addIntTime)); var addStringsTime = Date.now() / 1000; for (var i = 1; i < 10000; i++) { _currentSession.assert("foo"); } console.log("Add 10000 strings time: "+(Date.now() / 1000 - addStringsTime)); var addArrayTime = Date.now() / 1000; for (var i = 1; i < 10000; i++) { _currentSession.assert([1, 2, 3]); } console.log("Add 10000 arrays time: "+(Date.now() / 1000 - addArrayTime)); var addObjectTime = Date.now() / 1000; for (var i = 1; i < 10000; i++) { _currentSession.assert({foo: "bar", baz: [42, "foobar", 24]}); } console.log("Add 10000 objects time: "+(Date.now() / 1000 - addObjectTime)); var addDefinedObjectTime = Date.now() / 1000; for (var i = 1; i < 10; i++) { _currentSession.assert(new _MyObject("foo", "bar", {foo: "baz"})); } console.log("Add 10 predefined objects time: "+(Date.now() / 1000 - addDefinedObjectTime));
produced these times for asserting different data types.
Add 10000 integers time: 0.06599998474121094 Add 10000 strings time: 0.06400012969970703 Add 10000 arrays time: 0.06499981880187988 Add 10000 objects time: 0.0690000057220459 Add 10 defined objects time: 7.391999959945679
The text was updated successfully, but these errors were encountered:
Here are the times for individual objects:
Add predefined object time: 0.002000093460083008 Add predefined object time: 0.007999897003173828 Add predefined object time: 0.015000104904174805 Add predefined object time: 0.06499981880187988 Add predefined object time: 0.14400005340576172 Add predefined object time: 0.39100003242492676 Add predefined object time: 1.003000020980835 Add predefined object time: 3.2190001010894775 Add predefined object time: 4.48799991607666 Add 10 predefined objects time: 9.337000131607056
Seems to be an exponentially increase.
Sorry, something went wrong.
Further research did reveal that not the type of the object is the cause for the long assertion times, rather the following rule:
rule "4cde00e8-4118-46a5-815c-32ec47f76a9f" { when { c1 : MyObject; c2 : MyObject; c3 : MyObject; c4 : MyObject; c5 : MyObject; c6 : MyObject; c7 : MyObject c1.id == 'ID1' && c1.value == '127' && (c2.id == 'ID1' && c2.value == '124' || c2.id == 'ID1' && c2.value == '125') && (c3.id == 'ID1' && c3.value == '128' || c3.id == 'ID1' && c3.value == '125') && c4.id == 'ID2' && c4.parameters['P1'] == 'PV1' && c4.value < '20.0' && c5.id == 'ID3' && c5.value == 'FEATURE_PHONE' && c6.id == 'ID4' && c6.value == '13.13021' && c7.id == 'ID5' && c7.value == '52.39346'; } then { emit("select", "126", facts); } }
No branches or pull requests
In my nools rule language file I have defined the following object:
I have noticed that adding instances of these objects takes a notably long time. Executing the following testing code,
produced these times for asserting different data types.
The text was updated successfully, but these errors were encountered: