Closed elias-pap closed 4 years ago
@elias-pap The formatPEM function is not a part of library itself, it is a part of examples only. Be aware that examples don’t exist in a “production” version of PKIjs. So if you do want to optimise examples then make a “examples_common.js” under examples folder and put all common functions there, not in library code. The PKIjs doesn’t provide “formatting PEM” functionality, it is too trivial.
Should be done now.
@elias-pap After your change command npm test
is not working.
@elias-pap After your change command
npm test
is not working.
Fixed.
formatPEM() was duplicated 15 times in different forms in the examples. I moved it into common.js and optimized it. The attached benchmark shows ~4x speedup in Firefox and ~20x speedup in Chromium/Brave.
formatPEM_benchmark.txt