-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { isValid } = require('cpf'); | ||
const { testUtil } = require('./testUtil'); | ||
|
||
testUtil(isValid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const cpfCheck = require('cpf-check'); | ||
const { testUtil } = require('./testUtil'); | ||
|
||
testUtil(cpfCheck.validate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { isValid } = require('@fnando/cpf'); | ||
const { testUtil } = require('./testUtil'); | ||
|
||
testUtil(isValid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "benchmark", | ||
"version": "0.2.2", | ||
"description": "cpf-wasm benchmars", | ||
"main": "index.js", | ||
"author": "Pedro Nascimento", | ||
"license": "MIT", | ||
"private": false, | ||
"scripts": { | ||
"benchmark:wasm": "time node wasm", | ||
"benchmark:cpf": "time node cpf", | ||
"benchmark:fnando-cpf": "time node fnando_cpf", | ||
"benchmark:cpf-check": "time node cpf_check" | ||
}, | ||
"dependencies": { | ||
"@fnando/cpf": "^1.0.1", | ||
"cpf": "^2.0.1", | ||
"cpf-check": "^3.0.0", | ||
"cpf-wasm": "^0.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function testUtil(test_closure) { | ||
const TEST_CPF_COUNT = 10000000; | ||
const ONE_PERCENT = TEST_CPF_COUNT/100; | ||
|
||
for (let i=0; i< TEST_CPF_COUNT; i += 1) { | ||
if (i % ONE_PERCENT === 0) console.log(`${i/ONE_PERCENT} %`); | ||
const cpfString = i.toString().padStart(11, '0'); | ||
test_closure(cpfString); | ||
} | ||
} | ||
|
||
module.exports = { testUtil }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { isValid } = require('cpf-wasm'); | ||
const { testUtil } = require('./testUtil'); | ||
|
||
testUtil(isValid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@fnando/cpf@^1.0.1": | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/@fnando/cpf/-/cpf-1.0.1.tgz#59838dc8dcf5e6f9e6fa6022b3411593a733f0e7" | ||
integrity sha512-7KdgB+x/825Wk0/qiud0U1QmJQydSBvH/0X8SQ9pAuOzhfzwH1Xsgd6efQFILgFcxE0QvNfYu2HadpPmsUzlgQ== | ||
|
||
cpf-check@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/cpf-check/-/cpf-check-3.0.0.tgz#7279a1f6998a9385da1386bbe427fbf78144b9ec" | ||
integrity sha512-IwUJdDJ57kheRXiO7govTBOcKsLK/AdDrVKfk6rYCCNDcOBUiY9zmUY0fWI4/S/oIpbhHWMcOD0O2DLawuwiBw== | ||
|
||
cpf-wasm@^0.1.1: | ||
version "0.1.1" | ||
resolved "https://registry.yarnpkg.com/cpf-wasm/-/cpf-wasm-0.1.1.tgz#7313460b675ec6ad71b737435dfadd4ae7f5cf96" | ||
integrity sha512-GqfZcPF/Oz837ArJO2KnSqXMU5qejMeyMLRLz+Vmys+Wo7FjEBSnxggSmOynNvB8/w6c4nZw9aU7FRLwUKtYGg== | ||
|
||
cpf@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/cpf/-/cpf-2.0.1.tgz#7979eb33f0a14e8217292944311faaba82cb7f02" | ||
integrity sha512-YpRbrpjQCDkZgMUOLxLfme8wE8X56fHXOGMGDsYA48f7UrjaCHU0TP8d+CKmxvNVjBDVtHiCUiBw8vfstdslbw== |