improve console benchmark
This commit is contained in:
parent
22a5421489
commit
f4a2d86b72
3 changed files with 17 additions and 7 deletions
10
build/app.js
10
build/app.js
|
|
@ -93,9 +93,12 @@ var benchmarkTimes = {
|
||||||
/* -------------------------- Functions ----------------------------- */
|
/* -------------------------- Functions ----------------------------- */
|
||||||
|
|
||||||
function Benchmark(bench) {
|
function Benchmark(bench) {
|
||||||
|
var result = 0;
|
||||||
|
|
||||||
for (var time in bench) {
|
for (var time in bench) {
|
||||||
if (bench[time].timeStart !== 0) {
|
if (bench[time].timeStart !== 0 && bench[time].timeEnd !== 0) {
|
||||||
console.info("".concat(bench[time].name, " time (ms) ="), bench[time].timeEnd - bench[time].timeStart);
|
result = bench[time].timeEnd - bench[time].timeStart;
|
||||||
|
console.info("".concat(bench[time].name, " time (ms) = %c").concat(result.toFixed(2)), "color: #008cdc; font-weight: 700;");
|
||||||
}
|
}
|
||||||
|
|
||||||
bench[time].timeStart = 0;
|
bench[time].timeStart = 0;
|
||||||
|
|
@ -1601,7 +1604,8 @@ function HKReadTextArea() {
|
||||||
|
|
||||||
|
|
||||||
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
|
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
|
||||||
console.info("HKReadTextArea() time (ms) =", benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart);
|
var result = benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart;
|
||||||
|
console.info("HKReadTextArea() time (ms) = %c".concat(result.toFixed(2)), "color: #008cdc; font-weight: 700;");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.saveAnalyzed = false;
|
_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.saveAnalyzed = false;
|
||||||
alert("This seems like not a valid Hollow Knight save.\n".concat(error));
|
alert("This seems like not a valid Hollow Knight save.\n".concat(error));
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -94,10 +94,14 @@ let benchmarkTimes = {
|
||||||
|
|
||||||
function Benchmark(bench) {
|
function Benchmark(bench) {
|
||||||
|
|
||||||
|
let result = 0;
|
||||||
|
|
||||||
for (let time in bench) {
|
for (let time in bench) {
|
||||||
|
|
||||||
if (bench[time].timeStart !== 0) {
|
if (bench[time].timeStart !== 0 && bench[time].timeEnd !== 0) {
|
||||||
console.info(`${bench[time].name} time (ms) =`, bench[time].timeEnd - bench[time].timeStart);
|
|
||||||
|
result = bench[time].timeEnd - bench[time].timeStart;
|
||||||
|
console.info(`${bench[time].name} time (ms) = %c${result.toFixed(2)}`, `color: #008cdc; font-weight: 700;`);
|
||||||
}
|
}
|
||||||
bench[time].timeStart = 0;
|
bench[time].timeStart = 0;
|
||||||
bench[time].timeEnd = 0;
|
bench[time].timeEnd = 0;
|
||||||
|
|
@ -1692,7 +1696,9 @@ function HKReadTextArea(textAreaId = "") {
|
||||||
// end benchmark and show results
|
// end benchmark and show results
|
||||||
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
|
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
|
||||||
|
|
||||||
console.info(`HKReadTextArea() time (ms) =`, benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart);
|
let result = benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart;
|
||||||
|
|
||||||
|
console.info(`HKReadTextArea() time (ms) = %c${result.toFixed(2)}`, `color: #008cdc; font-weight: 700;`);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
HK.saveAnalyzed = false;
|
HK.saveAnalyzed = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue