Merge pull request #1041 from javascript-obfuscator/m1-performance

Apple M1 performance fix
This commit is contained in:
Timofey Kachalov
2022-01-29 11:28:37 +03:00
committed by GitHub
3 changed files with 6 additions and 4 deletions
+1
View File
@@ -3,6 +3,7 @@ Change Log
v3.0.1
---
* Dependencies update
* Fixed performance for Apple M1 chip
v3.0.0
---
+1 -1
View File
@@ -111,7 +111,7 @@
"test:mocha": "mocha --require ts-node/register --require source-map-support/register test/index.spec.ts --exit",
"test:mocha-coverage": "nyc --reporter text-summary --no-clean yarn run test:mocha",
"test:mocha-coverage:report": "nyc report --reporter=lcov",
"test:mocha-memory-performance": "cross-env NODE_OPTIONS=--max-old-space-size=220 mocha --require ts-node/register test/performance-tests/JavaScriptObfuscatorMemory.spec.ts",
"test:mocha-memory-performance": "cross-env NODE_OPTIONS=--max-old-space-size=230 mocha --require ts-node/register test/performance-tests/JavaScriptObfuscatorMemory.spec.ts",
"test": "yarn run test:full",
"eslint": "eslint src/**/*.ts",
"git:addFiles": "git add .",
+4 -3
View File
@@ -104,14 +104,15 @@ export class NumberUtils {
currentFactor <= root;
currentFactor += incrementValue
) {
if (number % currentFactor !== 0) {
const compliment: number = number / currentFactor;
const check = (number - Math.floor(compliment) * currentFactor) !== 0;
if (check) {
continue;
}
factors.push(...[-currentFactor, currentFactor]);
const compliment: number = number / currentFactor;
if (compliment !== currentFactor) {
factors.push(...[-compliment, compliment]);
}