aet-time
v1.0.1
Published
a package that finds the faster algorithm among two
Downloads
3
Maintainers
Readme
Getting Started
Install using npm npm
:
npm install aet-time
When should you use aet-time?
- You have multiple algorithms in your code
- You need to find the faster algorithm
- Don't have the time to check the complexity
- Find the faster code by using this package
Usage
Let's get started by writing a test for a hypothetical function that runs a loop. First, create a script.js
file:
function fun1() {
for (let index = 0; index < 100; index++){}
}
Now let's add another function to compare with the previous one in the same script.js
file:
function fun2() {
for (let index = 0; index < 100000; index++){}
}
Now lets import the package into the file to find which function is faster:
const aet = require('aet')
console.log(aet(fun1, fun2));
Your final code should look something like this:
const aet = require('aet')
function fun1() {
for (let index = 0; index < 100000; index++){}
}
function fun2() {
for (let index = 0; index < 1000000000; index++){}
}
console.log(aet(fun1, fun2));
Replace the dummy functions fun1
and fun2
with the algorithms you made and want to compare.
If the Algo
given in the first
parameter is faster it returns
-1
If the Algo
given in the second
parameter is faster it returns
1
If both take the same time to execute it returns
0
Contributing
Feel free to contribute to this project by opening issues and pull requests
Licence
This is an MIT licenced Project