Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing minified files is slow #7

Open
smartt opened this issue Aug 25, 2011 · 2 comments
Open

Parsing minified files is slow #7

smartt opened this issue Aug 25, 2011 · 2 comments

Comments

@smartt
Copy link
Owner

smartt commented Aug 25, 2011

This, of course, needs a test case, and a definition of "slow". A quick look at crunching a yui-min.js field took:

  • 1.214 sec. using pypy 1.6
  • 5.032 sec. using python 2.6
  • 7.281 sec using python 3.2

I am surprised to see any one file taking over a second.

(For what it's worth, python2.6 is normally the fastest for me at running the test suite; and python3.2 is the slowest.)

@rlgomes
Copy link
Contributor

rlgomes commented Aug 25, 2011

I believe that if you remove the strip and foo replacements that the prcessing of that same file will be quite faster. The only thing that occurs to me is to have the foo and strip handlers only turned on with an option like -x which is for extended macro replacement features ?

Oh and also if you don't remove the @define xxx entries from the original file the calls ot the regex.sub(xxx) are quite heavy. I'll come up with a few ideas later in the day on how we can speed this up or have an option like -x for extended macro replacements (ie date, time) and another for stripping the define's such as --deldefines

@Skylark13
Copy link
Contributor

My pull request #12 adds an exclude functionality for just this reason. I had some large minified files all under a js/vendor directory and they took many seconds to parse, but I didn't need them to be parsed because they didn't have anything jsmacro needed to process in them. Sure it's a workaround but one that works well for me in practice. I wouldn't spit on parsing speed increases of course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants