Commit 5fc0961f authored by Romain Courteaud's avatar Romain Courteaud

wip perf test

parent 5cd8ff00
<!DOCTYPE html>
<!--
Copyright 2017, Nexedi SA
This program is free software: you can Use, Study, Modify and Redistribute
it under the terms of the GNU General Public License version 3, or (at your
option) any later version, as published by the Free Software Foundation.
You can also Link and Combine this program with other software covered by
the terms of any of the Free Software licenses or any of the Open Source
Initiative approved licenses and Convey the resulting work. Corresponding
source of such a combination shall include the source code for all other
software used.
This program is distributed WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See COPYING file for full licensing terms.
See https://www.nexedi.com/licensing for rationale and options.
-->
<html>
<head>
<title>Memory consumption for declareGadget</title>
<meta name="viewport" content="width=device-width, height=device-height"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="../node_modules/rsvp/dist/rsvp-2.0.4.js" type="text/javascript"></script>
<script src="../dist/renderjs-latest.js" type="text/javascript"></script>
<script src="declareGadgetSpeed.js" type="text/javascript"></script>
</head>
<body>
<div></div>
</body>
</html>
/*jslint nomen: true*/
(function (window, rJS) {
"use strict";
rJS(window)
/*
.declareService(function () {
var list = [],
i;
for (i = 0; i < 10000; i += 1) {
// list.push(document.createElement('div'));
list.push(new RSVP.Queue());
}
this._list = list;
console.log('lala3');
return RSVP.all(list);
});
*/
.declareService(function () {
var gadget = this,
count = 1000,
total = 1 * count,
now;
return this.declareGadget('sub2.html')
.push(function () {
var promise_list = [],
i;
now = new Date();
for (i = 0; i < count; i += 1) {
promise_list.push(gadget.declareGadget('sub2.html'));
}
gadget.element.textContent = 'Creating ' + total + ' gadgets...';
return RSVP.all(promise_list);
})
.push(function () {
var stop = new Date(),
diff = stop.getTime() - now.getTime(),
duration = Math.abs(diff / 1000);
gadget.element.textContent = total + ' gadgets created in ' + duration + 's (' + diff / total + 'ms)';
});
});
}(window, rJS));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment