-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
ERROR java.lang.RuntimeException: Method code too large! #235
Comments
Hmm... this looks like a limitation of the Java Virtual Machine. In googling the error message, it appears that the bytecode for a Java class can be at most 64 KB. So the questions are, 1) where exactly is all this byte code being generated? and 2) what can we do to work around this limitation? My theory is that this has to do with the parsing phase... can you try running If that succeeds, then try |
|
That's good to know -- so the issue must be something to do with huge Java classes being generated when the Clojure code gets eval'd. Can you post the output of |
Any way I could make this collapsable? It's really long...
EDIT: truncated and pasted here: http://pastebin.com/36Tn9XXm - Dave |
I tried evaluating this huge Clojure expression and got the same "Method code too large!" error after running I found this relevant discussion on the Clojure mailing list about evaluating machine-generated code, which is exactly what Alda does. The moral of the story seems to be that it's not a good idea to generate huge amounts of code and then evaluate it with @elyisgreat This limitation sucks, but I'm glad you ran into it, because it's going to force us to optimize the way the Alda parse/eval process works. This will be a fairly involved change... I hope you don't mind if this issue stays open for a while. I think the solution is going to be moving away from #133 should help as a workaround for this issue, too, although ideally I'd like to solve it so that there isn't a limitation to how long an Alda score can be. |
I did a little testing and it appears that the size limit of an Alda score, with our current |
I have a work-in-progress branch where I implemented the non-eval-based solution I mentioned above. It can handle parsing a large score (I made one by copy-pasting the Bach cello suite example three times) without running into the "Method code too large!" error, but unfortunately, performance is worse than what we have currently. For example, it takes 3 seconds to process the Bach cello suite example, whereas what we have currently does it in 2 seconds. I think this approach might still be feasible if we can optimize the parser. (related: #208) |
Doing some more experimentation using 3 versions of Alda...
Average time to parse/evaluate the Bach cello suite example:
So, even with the parser optimizations*, trying to work around the "Method code too large!" error by pre-compiling the score instead of generating Clojure code and evaluating it like we're doing currently, causes a substantial performance hit. This is disappointing. I'm not willing to make a change that will make the parse/eval process even slower than it already is, so back to the drawing board I guess. I'm going to try still generating the Clojure code, but trying to break it up into smaller chunks and eval-ing them separately as part of the same score. *As an aside, it's surprising that the parsing optimizations only save us 0.2 seconds here, whereas in the benchmarking tests, they save about 0.5-0.6 seconds. I wonder if the server is causing additional overhead. |
After exploring this a little more, it turns out that the performance issues I thought I was seeing above are actually largely due to the Alda server pretty-printing the parse responses. (I was testing by running Ideally, I'd like for |
It seems like *The Bach example takes 850-900 ms to parse to Clojure code and then I think I'll prepare a release of Alda that includes both the parser optimizations and the change to not use |
Fixed in 1.0.0-rc19. |
Oops... looks like a bug snuck in. Sorry! Will fix ASAP. |
OK, fixed in 1.0.0-rc20 😜 |
Changed the key of my score, which caused some
+
characters to be added. Doesn't seem to like the new length, as the server is throwing this error whenever I try to play it:[27713] ERROR java.lang.RuntimeException: Method code too large!, compiling:(NO_SOURCE_PATH:0:0)
This happens when loading files into the REPL as well.
in 1.0.0rc14 it loads, however that was back when
[27713] ERROR Read timed out
was an issue. I wonder if that had anything to do with it?The text was updated successfully, but these errors were encountered: