benchmark times
This commit is contained in:
parent
3d556c1bc8
commit
de18910a2c
4 changed files with 65 additions and 38 deletions
51
build/app.js
51
build/app.js
|
|
@ -10,7 +10,9 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "HKCheckCompletion": () => (/* binding */ HKCheckCompletion)
|
/* harmony export */ "HKCheckCompletion": () => (/* binding */ HKCheckCompletion),
|
||||||
|
/* harmony export */ "benchmarkTimes": () => (/* binding */ benchmarkTimes),
|
||||||
|
/* harmony export */ "Benchmark": () => (/* binding */ Benchmark)
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* harmony import */ var _hk_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hk-database.js */ "./src/js/hk-database.js");
|
/* harmony import */ var _hk_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hk-database.js */ "./src/js/hk-database.js");
|
||||||
/* harmony import */ var _page_functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./page-functions.js */ "./src/js/page-functions.js");
|
/* harmony import */ var _page_functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./page-functions.js */ "./src/js/page-functions.js");
|
||||||
|
|
@ -59,19 +61,25 @@ var divStart = ["<div class='single-entry'>"].join("\n");
|
||||||
var divStartCenter = ["<div class='flex-container align-center'>"].join("\n");
|
var divStartCenter = ["<div class='flex-container align-center'>"].join("\n");
|
||||||
var divEnd = ["</div>"].join("\n");
|
var divEnd = ["</div>"].join("\n");
|
||||||
var pSpan = "<span class='p-left-small'></span>";
|
var pSpan = "<span class='p-left-small'></span>";
|
||||||
var benchHKCCBegin, benchHKCCEnd;
|
/* let benchHKCCBegin, benchHKCCEnd; */
|
||||||
var benchmark = {
|
|
||||||
loadSaveFile: {
|
var benchmarkTimes = {
|
||||||
|
LoadSaveFile: {
|
||||||
name: "LoadSaveFile()",
|
name: "LoadSaveFile()",
|
||||||
timeStart: 0,
|
timeStart: 0,
|
||||||
timeEnd: 0
|
timeEnd: 0
|
||||||
},
|
},
|
||||||
checkCompletion: {
|
CheckCompletion: {
|
||||||
name: "HKCheckCompletion()",
|
name: "HKCheckCompletion()",
|
||||||
timeStart: 0,
|
timeStart: 0,
|
||||||
timeEnd: 0
|
timeEnd: 0
|
||||||
},
|
},
|
||||||
total: {
|
GenerateInnerHTML: {
|
||||||
|
name: "GenerateInnerHTML()",
|
||||||
|
timeStart: 0,
|
||||||
|
timeEnd: 0
|
||||||
|
},
|
||||||
|
Total: {
|
||||||
name: "Total",
|
name: "Total",
|
||||||
timeStart: 0,
|
timeStart: 0,
|
||||||
timeEnd: 0
|
timeEnd: 0
|
||||||
|
|
@ -94,8 +102,8 @@ function Benchmark(bench) {
|
||||||
|
|
||||||
function HKCheckCompletion(jsonObject) {
|
function HKCheckCompletion(jsonObject) {
|
||||||
// start benchmark
|
// start benchmark
|
||||||
benchHKCCBegin = new Date();
|
// benchHKCCBegin = new Date();
|
||||||
benchmark.checkCompletion.timeStart = new Date();
|
benchmarkTimes.CheckCompletion.timeStart = new Date();
|
||||||
var HKPlayerData;
|
var HKPlayerData;
|
||||||
var HKWorldItems;
|
var HKWorldItems;
|
||||||
var HKSceneData;
|
var HKSceneData;
|
||||||
|
|
@ -202,11 +210,11 @@ function HKCheckCompletion(jsonObject) {
|
||||||
|
|
||||||
/* document.getElementById("save-area").focus({preventScroll: true}); */
|
/* document.getElementById("save-area").focus({preventScroll: true}); */
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
|
// benchHKCCEnd = new Date();
|
||||||
|
|
||||||
|
benchmarkTimes.CheckCompletion.timeEnd = new Date(); // console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
||||||
|
// Benchmark(benchmarkTimes);
|
||||||
|
|
||||||
benchHKCCEnd = new Date();
|
|
||||||
benchmark.checkCompletion.timeEnd = new Date();
|
|
||||||
console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
|
||||||
Benchmark(benchmark);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -1680,7 +1688,8 @@ var AES_KEY = new TextEncoder().encode('UKu52ePUBwetZ9wNX88o54dnfKRu0T1l'); // e
|
||||||
var ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a new AES stream cipher object using the encoded key
|
var ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a new AES stream cipher object using the encoded key
|
||||||
// ---------------- Variables ----------------- //
|
// ---------------- Variables ----------------- //
|
||||||
|
|
||||||
var benchLSFBegin, benchLSFEnd, benchTotal; // ---------------- Functions ----------------- //
|
/* let benchLSFBegin, benchLSFEnd, benchTotal; */
|
||||||
|
// ---------------- Functions ----------------- //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main input tag file function. Selects the first file, reads it as an Array Buffer, starts the processing of the file when loaded.
|
* Main input tag file function. Selects the first file, reads it as an Array Buffer, starts the processing of the file when loaded.
|
||||||
|
|
@ -1695,7 +1704,8 @@ function LoadSaveFile(input, time) {
|
||||||
|
|
||||||
if (inputFileList.length < 1) return false; // start benchmark
|
if (inputFileList.length < 1) return false; // start benchmark
|
||||||
|
|
||||||
benchLSFBegin = time; // Prepares a File object from the first file of the input files for reading as an Array Buffer
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.LoadSaveFile.timeStart = time;
|
||||||
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.Total.timeStart = time; // Prepares a File object from the first file of the input files for reading as an Array Buffer
|
||||||
|
|
||||||
var inputFileObject = inputFileList[0]; // Cleans the file list to avoid problems after subsequent use
|
var inputFileObject = inputFileList[0]; // Cleans the file list to avoid problems after subsequent use
|
||||||
// document.getElementById("save-area-file").value = "";
|
// document.getElementById("save-area-file").value = "";
|
||||||
|
|
@ -1735,8 +1745,11 @@ function ProcessFileObject() {
|
||||||
|
|
||||||
decodedString = new TextDecoder().decode(inputArrayBuffer); // finish and show benchmark
|
decodedString = new TextDecoder().decode(inputArrayBuffer); // finish and show benchmark
|
||||||
|
|
||||||
benchLSFEnd = new Date();
|
/* benchLSFEnd = new Date(); */
|
||||||
console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin); // 4. Analyze the decoded string immediately
|
|
||||||
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.LoadSaveFile.timeEnd = new Date();
|
||||||
|
/* console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin); */
|
||||||
|
// 4. Analyze the decoded string immediately
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(0,_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.HKCheckCompletion)(JSON.parse(decodedString));
|
(0,_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.HKCheckCompletion)(JSON.parse(decodedString));
|
||||||
|
|
@ -1767,8 +1780,10 @@ function ProcessFileObject() {
|
||||||
}))(); // finish total and show benchmark
|
}))(); // finish total and show benchmark
|
||||||
|
|
||||||
|
|
||||||
benchTotal = new Date();
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.Total.timeEnd = new Date();
|
||||||
console.info("Total time (ms) =", benchTotal - benchLSFBegin); // alert(`Decoded String: ${decodedString}`);
|
(0,_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.Benchmark)(_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes);
|
||||||
|
/* console.info("Total time (ms) =", benchTotal - benchLSFBegin); */
|
||||||
|
// alert(`Decoded String: ${decodedString}`);
|
||||||
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert("The file cannot be decoded. ".concat(error));
|
alert("The file cannot be decoded. ".concat(error));
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -60,20 +60,25 @@ let divEnd = [
|
||||||
|
|
||||||
let pSpan = "<span class='p-left-small'></span>";
|
let pSpan = "<span class='p-left-small'></span>";
|
||||||
|
|
||||||
let benchHKCCBegin, benchHKCCEnd;
|
/* let benchHKCCBegin, benchHKCCEnd; */
|
||||||
|
|
||||||
let benchmark = {
|
let benchmarkTimes = {
|
||||||
loadSaveFile: {
|
LoadSaveFile: {
|
||||||
name: "LoadSaveFile()",
|
name: "LoadSaveFile()",
|
||||||
timeStart: 0,
|
timeStart: 0,
|
||||||
timeEnd: 0
|
timeEnd: 0
|
||||||
},
|
},
|
||||||
checkCompletion: {
|
CheckCompletion: {
|
||||||
name: "HKCheckCompletion()",
|
name: "HKCheckCompletion()",
|
||||||
timeStart: 0,
|
timeStart: 0,
|
||||||
timeEnd: 0
|
timeEnd: 0
|
||||||
},
|
},
|
||||||
total: {
|
GenerateInnerHTML: {
|
||||||
|
name: "GenerateInnerHTML()",
|
||||||
|
timeStart: 0,
|
||||||
|
timeEnd: 0
|
||||||
|
},
|
||||||
|
Total: {
|
||||||
name: "Total",
|
name: "Total",
|
||||||
timeStart: 0,
|
timeStart: 0,
|
||||||
timeEnd: 0
|
timeEnd: 0
|
||||||
|
|
@ -98,8 +103,8 @@ function Benchmark(bench) {
|
||||||
function HKCheckCompletion(jsonObject) {
|
function HKCheckCompletion(jsonObject) {
|
||||||
|
|
||||||
// start benchmark
|
// start benchmark
|
||||||
benchHKCCBegin = new Date();
|
// benchHKCCBegin = new Date();
|
||||||
benchmark.checkCompletion.timeStart = new Date();
|
benchmarkTimes.CheckCompletion.timeStart = new Date();
|
||||||
|
|
||||||
let HKPlayerData;
|
let HKPlayerData;
|
||||||
let HKWorldItems;
|
let HKWorldItems;
|
||||||
|
|
@ -277,11 +282,11 @@ function HKCheckCompletion(jsonObject) {
|
||||||
/* document.getElementById("save-area").focus({preventScroll: true}); */
|
/* document.getElementById("save-area").focus({preventScroll: true}); */
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
benchHKCCEnd = new Date();
|
// benchHKCCEnd = new Date();
|
||||||
benchmark.checkCompletion.timeEnd = new Date();
|
benchmarkTimes.CheckCompletion.timeEnd = new Date();
|
||||||
console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
// console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
||||||
|
|
||||||
Benchmark(benchmark);
|
// Benchmark(benchmarkTimes);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1739,5 +1744,7 @@ document.getElementById("save-area-read").addEventListener("click", () => {
|
||||||
|
|
||||||
export {
|
export {
|
||||||
// to use in LoadSaveFile.js for auto-analyzing file after decoding
|
// to use in LoadSaveFile.js for auto-analyzing file after decoding
|
||||||
HKCheckCompletion
|
HKCheckCompletion,
|
||||||
|
benchmarkTimes,
|
||||||
|
Benchmark
|
||||||
};
|
};
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
const aesjs = require("./aes-js.js");
|
const aesjs = require("./aes-js.js");
|
||||||
// For reading the text area after save decoding
|
// For reading the text area after save decoding
|
||||||
import {
|
import {
|
||||||
HKCheckCompletion
|
HKCheckCompletion,
|
||||||
|
benchmarkTimes,
|
||||||
|
Benchmark
|
||||||
} from "./HKCheckCompletion.js";
|
} from "./HKCheckCompletion.js";
|
||||||
|
|
||||||
const CSHARP_HEADER = [0, 1, 0, 0, 0, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 0]; // 22 bytes
|
const CSHARP_HEADER = [0, 1, 0, 0, 0, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 0]; // 22 bytes
|
||||||
|
|
@ -23,7 +25,7 @@ const ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a ne
|
||||||
|
|
||||||
// ---------------- Variables ----------------- //
|
// ---------------- Variables ----------------- //
|
||||||
|
|
||||||
let benchLSFBegin, benchLSFEnd, benchTotal;
|
/* let benchLSFBegin, benchLSFEnd, benchTotal; */
|
||||||
|
|
||||||
// ---------------- Functions ----------------- //
|
// ---------------- Functions ----------------- //
|
||||||
|
|
||||||
|
|
@ -41,7 +43,8 @@ function LoadSaveFile(input, time) {
|
||||||
if (inputFileList.length < 1) return false;
|
if (inputFileList.length < 1) return false;
|
||||||
|
|
||||||
// start benchmark
|
// start benchmark
|
||||||
benchLSFBegin = time;
|
benchmarkTimes.LoadSaveFile.timeStart = time;
|
||||||
|
benchmarkTimes.Total.timeStart = time;
|
||||||
|
|
||||||
// Prepares a File object from the first file of the input files for reading as an Array Buffer
|
// Prepares a File object from the first file of the input files for reading as an Array Buffer
|
||||||
let inputFileObject = inputFileList[0];
|
let inputFileObject = inputFileList[0];
|
||||||
|
|
@ -92,8 +95,9 @@ function ProcessFileObject() {
|
||||||
decodedString = new TextDecoder().decode(inputArrayBuffer);
|
decodedString = new TextDecoder().decode(inputArrayBuffer);
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
benchLSFEnd = new Date();
|
/* benchLSFEnd = new Date(); */
|
||||||
console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin);
|
benchmarkTimes.LoadSaveFile.timeEnd = new Date();
|
||||||
|
/* console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin); */
|
||||||
|
|
||||||
// 4. Analyze the decoded string immediately
|
// 4. Analyze the decoded string immediately
|
||||||
try {
|
try {
|
||||||
|
|
@ -110,8 +114,9 @@ function ProcessFileObject() {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// finish total and show benchmark
|
// finish total and show benchmark
|
||||||
benchTotal = new Date();
|
benchmarkTimes.Total.timeEnd = new Date();
|
||||||
console.info("Total time (ms) =", benchTotal - benchLSFBegin);
|
Benchmark(benchmarkTimes);
|
||||||
|
/* console.info("Total time (ms) =", benchTotal - benchLSFBegin); */
|
||||||
|
|
||||||
// alert(`Decoded String: ${decodedString}`);
|
// alert(`Decoded String: ${decodedString}`);
|
||||||
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue