Put the size and startup cost of a MeowShield build on a budget, measured in CI
Obfuscation is a trade: you make code more expensive to read, and you usually pay something in bytes and runtime. The mistake is not paying; it is paying without measuring, so a later option change quietly doubles your d
Obfuscation is a trade: you make code more expensive to read, and you usually pay something in bytes and runtime. The mistake is not paying; it is paying without measuring, so a later option change quietly doubles your download.
I help promote MeowShield. I am deliberately not quoting overhead numbers here. Its own Docs tell you to run a real sample and compare output, runtime behavior, and file size, and that is the right instinct: the cost depends on your code and the options you pick.
Measure three things, every build
- Transfer size of the protected file after compression (gzip or brotli, whatever your CDN serves).
- Parse/compile and first-execution time on a slow reference device or a CPU-throttled browser profile.
- Hot-path time for the one or two functions you actually protected, if they run often.
Record the same numbers for the unprotected build in the same job, so you compare like with like.
A minimal size check
raw=$(gzip -9 -c dist/app.js | wc -c)
prot=$(gzip -9 -c dist/app.protected.js | wc -c)
echo "gzip unprotected=$raw protected=$prot"
# fail if protected output grows past the budget you agreed on
BUDGET=${BUDGET_BYTES:-250000}
[ "$prot" -le "$BUDGET" ] || { echo "protected bundle over budget"; exit 1; }
The budget is yours to set. Start from today's measured value plus a margin, not from a guess.
A minimal timing check
For startup, use a real browser in CI (Playwright or Puppeteer) with CPU throttling, and read performance marks around your app's init. For a hot function, a small harness that calls it many times with fixed inputs is enough to spot a regression. Compare medians across several runs; single runs are noise.
What to do with the numbers
- If size jumped after an option change, revert that one option and confirm it was the cause.
- The Docs describe some options as adding volume without runtime hardening (for example, injected comments). Those are the first to question when bytes matter.
-
perfOptimizationis documented as biasing toward lower runtime overhead at some cost to strength. Test it on latency-sensitive paths rather than enabling it everywhere. - Protect only the module that needs it. Vendor code and UI glue rarely justify the cost.
Honest limits
A budget keeps cost visible; it does not make protection stronger. No obfuscation is absolute, and anything that must stay secret belongs on the server.
If you want a baseline to start the budget from, run your real file through the Playground at MeowShield and record the output size before you automate.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.