Optimize startup performance
sindresorhus opened this issue · 2 comments
I would like meow
to have as little impact on startup performance as possible.
#67 is one way to improve that.
I will also do some profiling with DevTools to see what else can be optimized.
From memory, the
Line 78 in 646f30b
cli.pkg
. We only really need the description
field ourselves, which doesn't need to be normalized.
I'm open to other ideas and help with this.
I've just profiled a really small CLI app that takes ~2 seconds to run using the V8 profiler. This package came up as first for compile time. As you say, the normalizePackageData
is the most expensive, because normalize-package-data even parses the license field (using spdx-expression-parse) and parses all URLs with RegExps.
My suggestion would be to avoid reading the package.json
if the user passes a pkg: false
option, and the --help
and --version
flags are not present.
We don’t need the normalize stuff in Meow itself. So we could actually turn it off and only do it on demand if the user accesses the exported .pkg
property.