use performance.now() instead of Date
This commit is contained in:
parent
fd6af73f6a
commit
04ba3c131c
5 changed files with 21 additions and 21 deletions
20
build/app.js
20
build/app.js
|
|
@ -109,7 +109,7 @@ function Benchmark(bench) {
|
||||||
|
|
||||||
|
|
||||||
function HKCheckCompletion(jsonObject) {
|
function HKCheckCompletion(jsonObject) {
|
||||||
var benchStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
|
var benchStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : performance.now();
|
||||||
// start benchmark
|
// start benchmark
|
||||||
// benchHKCCBegin = new Date();
|
// benchHKCCBegin = new Date();
|
||||||
benchmarkTimes.CheckCompletion.timeStart = benchStart;
|
benchmarkTimes.CheckCompletion.timeStart = benchStart;
|
||||||
|
|
@ -222,7 +222,7 @@ function HKCheckCompletion(jsonObject) {
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
// benchHKCCEnd = new Date();
|
// benchHKCCEnd = new Date();
|
||||||
|
|
||||||
benchmarkTimes.CheckCompletion.timeEnd = new Date(); // console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
benchmarkTimes.CheckCompletion.timeEnd = performance.now(); // console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
||||||
// Benchmark(benchmarkTimes);
|
// Benchmark(benchmarkTimes);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1585,7 +1585,7 @@ function CheckHintsTrue(section, dataObject, playerData, worldData) {
|
||||||
function HKReadTextArea() {
|
function HKReadTextArea() {
|
||||||
var textAreaId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
var textAreaId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
||||||
// start benchmark
|
// start benchmark
|
||||||
benchmarkTimes.HKReadTextArea.timeStart = new Date(); // starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
|
benchmarkTimes.HKReadTextArea.timeStart = performance.now(); // starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
|
||||||
|
|
||||||
InitializeHTMLPopulation(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default);
|
InitializeHTMLPopulation(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default);
|
||||||
var contents = document.getElementById(textAreaId).value;
|
var contents = document.getElementById(textAreaId).value;
|
||||||
|
|
@ -1597,7 +1597,7 @@ function HKReadTextArea() {
|
||||||
if (jsonObject.hasOwnProperty("playerData")) HKCheckCompletion(jsonObject); // console.log(jsonObject);
|
if (jsonObject.hasOwnProperty("playerData")) HKCheckCompletion(jsonObject); // console.log(jsonObject);
|
||||||
// end benchmark and show results
|
// end benchmark and show results
|
||||||
|
|
||||||
benchmarkTimes.HKReadTextArea.timeEnd = new Date();
|
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
|
||||||
console.info("HKReadTextArea() time (ms) =", benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart);
|
console.info("HKReadTextArea() time (ms) =", benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.saveAnalyzed = false;
|
_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.saveAnalyzed = false;
|
||||||
|
|
@ -1796,7 +1796,7 @@ function ProcessFileObject() {
|
||||||
|
|
||||||
/* benchLSFEnd = new Date(); */
|
/* benchLSFEnd = new Date(); */
|
||||||
|
|
||||||
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.LoadSaveFile.timeEnd = new Date();
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.LoadSaveFile.timeEnd = performance.now();
|
||||||
/* console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin); */
|
/* console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin); */
|
||||||
// 4. Analyze the decoded string immediately
|
// 4. Analyze the decoded string immediately
|
||||||
|
|
||||||
|
|
@ -1829,7 +1829,7 @@ function ProcessFileObject() {
|
||||||
}))(); // finish total and show benchmark
|
}))(); // finish total and show benchmark
|
||||||
|
|
||||||
|
|
||||||
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.Total.timeEnd = new Date();
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.Total.timeEnd = performance.now();
|
||||||
(0,_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.Benchmark)(_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes);
|
(0,_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.Benchmark)(_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes);
|
||||||
/* console.info("Total time (ms) =", benchTotal - benchLSFBegin); */
|
/* console.info("Total time (ms) =", benchTotal - benchLSFBegin); */
|
||||||
// alert(`Decoded String: ${decodedString}`);
|
// alert(`Decoded String: ${decodedString}`);
|
||||||
|
|
@ -1924,7 +1924,7 @@ function AESDecryption(buffer) {
|
||||||
|
|
||||||
|
|
||||||
document.getElementById("save-area-file").addEventListener("change", function (event) {
|
document.getElementById("save-area-file").addEventListener("change", function (event) {
|
||||||
LoadSaveFile(event.target, new Date());
|
LoadSaveFile(event.target, performance.now());
|
||||||
});
|
});
|
||||||
document.getElementById("save-area-file").addEventListener("click", function (mouseEvent) {
|
document.getElementById("save-area-file").addEventListener("click", function (mouseEvent) {
|
||||||
mouseEvent.target.value = "";
|
mouseEvent.target.value = "";
|
||||||
|
|
@ -5266,7 +5266,7 @@ function CompletionHTML(jsObj, hkGameCompletion) {
|
||||||
|
|
||||||
function GenerateInnerHTML(db) {
|
function GenerateInnerHTML(db) {
|
||||||
// start benchmarking
|
// start benchmarking
|
||||||
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.GenerateInnerHTML.timeStart = new Date();
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.GenerateInnerHTML.timeStart = performance.now();
|
||||||
var sections = db.sections;
|
var sections = db.sections;
|
||||||
/* console.log(sections); */
|
/* console.log(sections); */
|
||||||
|
|
||||||
|
|
@ -5587,7 +5587,7 @@ function GenerateInnerHTML(db) {
|
||||||
|
|
||||||
document.getElementById("generated").innerHTML = finalHTMLFill; // finish benchmarking
|
document.getElementById("generated").innerHTML = finalHTMLFill; // finish benchmarking
|
||||||
|
|
||||||
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.GenerateInnerHTML.timeEnd = new Date();
|
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.GenerateInnerHTML.timeEnd = performance.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
function SectionDescription(section) {
|
function SectionDescription(section) {
|
||||||
|
|
@ -6160,7 +6160,7 @@ window.addEventListener('drop', function (event) {
|
||||||
var dt = event.dataTransfer;
|
var dt = event.dataTransfer;
|
||||||
/* Launch save file analyzing */
|
/* Launch save file analyzing */
|
||||||
|
|
||||||
(0,_LoadSaveFile_js__WEBPACK_IMPORTED_MODULE_1__.LoadSaveFile)(dt, new Date());
|
(0,_LoadSaveFile_js__WEBPACK_IMPORTED_MODULE_1__.LoadSaveFile)(dt, performance.now());
|
||||||
var label = document.getElementById("save-area-file").nextElementSibling;
|
var label = document.getElementById("save-area-file").nextElementSibling;
|
||||||
var labelInitialText = label.innerHTML;
|
var labelInitialText = label.innerHTML;
|
||||||
/* Shorten the file name if longer than 16 characters. Display first 10 characters and last 4. */
|
/* Shorten the file name if longer than 16 characters. Display first 10 characters and last 4. */
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -108,7 +108,7 @@ function Benchmark(bench) {
|
||||||
* Main Function. Checks Hollow Knight game completion by analyzing the save file
|
* Main Function. Checks Hollow Knight game completion by analyzing the save file
|
||||||
* @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON)
|
* @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON)
|
||||||
*/
|
*/
|
||||||
function HKCheckCompletion(jsonObject, benchStart = new Date()) {
|
function HKCheckCompletion(jsonObject, benchStart = performance.now()) {
|
||||||
|
|
||||||
// start benchmark
|
// start benchmark
|
||||||
// benchHKCCBegin = new Date();
|
// benchHKCCBegin = new Date();
|
||||||
|
|
@ -292,7 +292,7 @@ function HKCheckCompletion(jsonObject, benchStart = new Date()) {
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
// benchHKCCEnd = new Date();
|
// benchHKCCEnd = new Date();
|
||||||
benchmarkTimes.CheckCompletion.timeEnd = new Date();
|
benchmarkTimes.CheckCompletion.timeEnd = performance.now();
|
||||||
// console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
// console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
||||||
|
|
||||||
// Benchmark(benchmarkTimes);
|
// Benchmark(benchmarkTimes);
|
||||||
|
|
@ -1672,7 +1672,7 @@ function CheckHintsTrue(section, dataObject, playerData, worldData) {
|
||||||
function HKReadTextArea(textAreaId = "") {
|
function HKReadTextArea(textAreaId = "") {
|
||||||
|
|
||||||
// start benchmark
|
// start benchmark
|
||||||
benchmarkTimes.HKReadTextArea.timeStart = new Date();
|
benchmarkTimes.HKReadTextArea.timeStart = performance.now();
|
||||||
|
|
||||||
// starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
|
// starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
|
||||||
InitializeHTMLPopulation(HK);
|
InitializeHTMLPopulation(HK);
|
||||||
|
|
@ -1688,7 +1688,7 @@ function HKReadTextArea(textAreaId = "") {
|
||||||
// console.log(jsonObject);
|
// console.log(jsonObject);
|
||||||
|
|
||||||
// end benchmark and show results
|
// end benchmark and show results
|
||||||
benchmarkTimes.HKReadTextArea.timeEnd = new Date();
|
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
|
||||||
|
|
||||||
console.info(`HKReadTextArea() time (ms) =`, benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart);
|
console.info(`HKReadTextArea() time (ms) =`, benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ function ProcessFileObject() {
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
/* benchLSFEnd = new Date(); */
|
/* benchLSFEnd = new Date(); */
|
||||||
benchmarkTimes.LoadSaveFile.timeEnd = new Date();
|
benchmarkTimes.LoadSaveFile.timeEnd = performance.now();
|
||||||
/* console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin); */
|
/* console.info("LoadSaveFile() time (ms) =", benchLSFEnd - benchLSFBegin); */
|
||||||
|
|
||||||
// 4. Analyze the decoded string immediately
|
// 4. Analyze the decoded string immediately
|
||||||
|
|
@ -114,7 +114,7 @@ function ProcessFileObject() {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// finish total and show benchmark
|
// finish total and show benchmark
|
||||||
benchmarkTimes.Total.timeEnd = new Date();
|
benchmarkTimes.Total.timeEnd = performance.now();
|
||||||
|
|
||||||
Benchmark(benchmarkTimes);
|
Benchmark(benchmarkTimes);
|
||||||
/* console.info("Total time (ms) =", benchTotal - benchLSFBegin); */
|
/* console.info("Total time (ms) =", benchTotal - benchLSFBegin); */
|
||||||
|
|
@ -202,7 +202,7 @@ function AESDecryption(buffer, cipherObject = ECB_STREAM_CIPHER) {
|
||||||
|
|
||||||
// Assign actions (functions) to launch when a specific element is used
|
// Assign actions (functions) to launch when a specific element is used
|
||||||
document.getElementById("save-area-file").addEventListener("change", (event) => {
|
document.getElementById("save-area-file").addEventListener("change", (event) => {
|
||||||
LoadSaveFile(event.target, new Date());
|
LoadSaveFile(event.target, performance.now());
|
||||||
});
|
});
|
||||||
document.getElementById("save-area-file").addEventListener("click", (mouseEvent) => {
|
document.getElementById("save-area-file").addEventListener("click", (mouseEvent) => {
|
||||||
mouseEvent.target.value = "";
|
mouseEvent.target.value = "";
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ function CompletionHTML(jsObj, hkGameCompletion) {
|
||||||
function GenerateInnerHTML(db) {
|
function GenerateInnerHTML(db) {
|
||||||
|
|
||||||
// start benchmarking
|
// start benchmarking
|
||||||
benchmarkTimes.GenerateInnerHTML.timeStart = new Date();
|
benchmarkTimes.GenerateInnerHTML.timeStart = performance.now();
|
||||||
|
|
||||||
let sections = db.sections;
|
let sections = db.sections;
|
||||||
|
|
||||||
|
|
@ -497,7 +497,7 @@ function GenerateInnerHTML(db) {
|
||||||
document.getElementById("generated").innerHTML = finalHTMLFill;
|
document.getElementById("generated").innerHTML = finalHTMLFill;
|
||||||
|
|
||||||
// finish benchmarking
|
// finish benchmarking
|
||||||
benchmarkTimes.GenerateInnerHTML.timeEnd = new Date();
|
benchmarkTimes.GenerateInnerHTML.timeEnd = performance.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
function SectionDescription(section) {
|
function SectionDescription(section) {
|
||||||
|
|
@ -1153,7 +1153,7 @@ window.addEventListener('drop', (event) => {
|
||||||
const dt = event.dataTransfer;
|
const dt = event.dataTransfer;
|
||||||
|
|
||||||
/* Launch save file analyzing */
|
/* Launch save file analyzing */
|
||||||
LoadSaveFile(dt, new Date());
|
LoadSaveFile(dt, performance.now());
|
||||||
|
|
||||||
var label = document.getElementById("save-area-file").nextElementSibling;
|
var label = document.getElementById("save-area-file").nextElementSibling;
|
||||||
var labelInitialText = label.innerHTML;
|
var labelInitialText = label.innerHTML;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue