Shawn
05-06-2021, 02:08 PM
TLDR: What's a good way to time the speed of my script?
Inside a function or when I call the function?
I'm currently using performance.now() to time, should I use this?
I'm working on a main shop ABer and I'm working on solving pet captcha portion.
I know there's a publicly-available method of solving this captcha but I decided to try to work on my own.
After completing mine, I believe I might have something that's more accurate and faster.
The improved accuracy is a certainty, but I want to make sure that my captcha solving function is not slowed down by this.
How should I measure how long my function takes to solve?
This is what I'm doing currently:
myOwnSolver(img)
publicSolver(img)
function myOwnSolver(img) {
let a = performance.now()
... function stuff ...
let b = performance.now()
console.log(`My Own: ${b-a} ms`);
}
function publicSolver(img) {
let a = performance.now()
... function stuff ...
let b = performance.now()
console.log(`Public: ${b-a} ms`);
}
Should I be timing when I call the function instead of inside the function itself?
let a = performance.now()
myOwnSolver(img)
let b = performance.now()
console.log(`My Own: ${b-a} ms`);
let a = performance.now()
publicSolver(img)
let b = performance.now()
console.log(`My Own: ${b-a} ms`);
function myOwnSolver(img) {
... function stuff ...
}
function publicSolver(img) {
... function stuff ...
}
:o_o:
Using my current method of timing, here are the results:
Solver is my most accurate captcha solver,
Super is an approximation of Solver for speed,
Free is the publicly-available solver
Solver:
127,17
31.000000017229468 ms
Super:
131,20
3.1350000062957406 ms
Free:
131,20
Free: 827.8300000238232 ms
Inside a function or when I call the function?
I'm currently using performance.now() to time, should I use this?
I'm working on a main shop ABer and I'm working on solving pet captcha portion.
I know there's a publicly-available method of solving this captcha but I decided to try to work on my own.
After completing mine, I believe I might have something that's more accurate and faster.
The improved accuracy is a certainty, but I want to make sure that my captcha solving function is not slowed down by this.
How should I measure how long my function takes to solve?
This is what I'm doing currently:
myOwnSolver(img)
publicSolver(img)
function myOwnSolver(img) {
let a = performance.now()
... function stuff ...
let b = performance.now()
console.log(`My Own: ${b-a} ms`);
}
function publicSolver(img) {
let a = performance.now()
... function stuff ...
let b = performance.now()
console.log(`Public: ${b-a} ms`);
}
Should I be timing when I call the function instead of inside the function itself?
let a = performance.now()
myOwnSolver(img)
let b = performance.now()
console.log(`My Own: ${b-a} ms`);
let a = performance.now()
publicSolver(img)
let b = performance.now()
console.log(`My Own: ${b-a} ms`);
function myOwnSolver(img) {
... function stuff ...
}
function publicSolver(img) {
... function stuff ...
}
:o_o:
Using my current method of timing, here are the results:
Solver is my most accurate captcha solver,
Super is an approximation of Solver for speed,
Free is the publicly-available solver
Solver:
127,17
31.000000017229468 ms
Super:
131,20
3.1350000062957406 ms
Free:
131,20
Free: 827.8300000238232 ms