Add debugging printouts to skillpoint computation and overall compute

This commit is contained in:
hppeng 2022-07-16 22:47:19 -07:00
parent 104930c15b
commit 6ba2383e2f
6 changed files with 20 additions and 9 deletions

View file

@ -390,7 +390,12 @@ window.onerror = function(message, source, lineno, colno, error) {
};
(async function() {
const start = Date.now();
let load_promises = [ load_init(), load_ing_init(), load_tome_init() ];
await Promise.all(load_promises);
const codestart = Date.now();
init();
const end = Date.now();
console.log(`builder calculation took ${(end-codestart)/ 1000} seconds.`);
console.log(`builder total took ${(end-start)/ 1000} seconds.`);
})();

View file

@ -1143,5 +1143,6 @@ function builder_graph_init() {
// this will propagate the update to the `stat_agg_node`, and then to damage calc
console.log("Set up graph");
let INPUT_UPDATE = true;
}

View file

@ -174,20 +174,24 @@ class ValueCheckComputeNode extends ComputeNode {
}
let INPUT_UPDATE = false;
/**
* Schedule a ComputeNode to be updated.
*
* @param node : ComputeNode to schedule an update for.
*/
function calcSchedule(node, timeout) {
if (node.update_task !== null) {
clearTimeout(node.update_task);
if (INPUT_UPDATE) {
if (node.update_task !== null) {
clearTimeout(node.update_task);
}
node.mark_dirty();
node.update_task = setTimeout(function() {
node.update();
node.update_task = null;
}, timeout);
}
node.mark_dirty();
node.update_task = setTimeout(function() {
node.update();
node.update_task = null;
}, timeout);
}
class PrintNode extends ComputeNode {

View file

@ -254,5 +254,4 @@ function init_maps() {
redirectMap.set(item.id, item.remapID);
}
}
console.log(itemMap);
}

View file

@ -232,5 +232,4 @@ function init_ing_maps() {
recipeList.push(recipe["name"]);
recipeIDMap.set(recipe["id"],recipe["name"]);
}
console.log(ingMap);
}

View file

@ -1,4 +1,5 @@
function calculate_skillpoints(equipment, weapon) {
const start = Date.now();
// Calculate equipment equipping order and required skillpoints.
// Return value: [equip_order, best_skillpoints, final_skillpoints, best_total];
let fixed = [];
@ -205,5 +206,7 @@ function calculate_skillpoints(equipment, weapon) {
// best_skillpoints: manually assigned (before any gear)
// final_skillpoints: final totals (5 individ)
// best_total: total skillpoints assigned (number)
const end = Date.now();
console.log(`skillpoint calculation took ${(end-start)/ 1000} seconds.`);
return [equip_order, best_skillpoints, final_skillpoints, best_total, best_activeSetCounts];
}