Optimize for performance by only using deterministic parser where needed#2062
Optimize for performance by only using deterministic parser where needed#2062Phergus merged 2 commits intoRPTools:developfrom
Conversation
…ded (TOOLTIP, expandRoll). This makes headless macros (those that work with h and r roll options) faster as no deterministic AST tree is generated within parser. Added unit tests for macro branch roll options that previously failed. Unit testing MapToolLineParser is difficult as it's not truly headless. There are calls to static methods that fail, so I hardened a bit where needed. fixes RPTools#1898
fixes RPTools#1898
Phergus
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r1.
Reviewable status:complete! all files reviewed, all discussions resolved
|
This gives my framework errors:
On the plus sign I noticed an impressive performance improvement. Example, this gives an error with the PR but didn't before: A workaround is to replace |
|
@Merudo checking your test on illegal argument |
|
confirmed - since json arrays are not flattened all the time the addition doesn't handle the + well, I'll add a test-case. You're workaround to convert to string is right but I think we can make this backwards compatible
|
|
It's because the parser was automatically converting json arrays and objects in variables to strings, and it isn't anymore. Example: This returns Which may be fine, really. The workaround is just to add If we keep this change, we should make it clear to users, though. |
Yep, jsons should be automatically converted to strings when used with the This would preserve backward compatibility while opening up other ways to deal with json elements. |
|
Yeah, it does makes sense to require conversion, otherwise most of functions don't make sense. Not good for those macro scripts using any of those functions below at this point |
|
@nmeier should we expect a fix for this or should it be reverted? |
|
My dev environment (Linux Mint 19.3, JDK 14) is failing a unit test starting at this merge commit - |
|
I think we should leave as is - making these operations backwards comp we can rule out for operations between string and the (non flattened) json objects. I think one can argue about (not)equals but the code is just full of assumptions about string/bigdecimal so I'm not sure it's worth it. |
|
@selquest looking at that test-case, it works here on Windows. The special characters that maptool adds for expanded Rolls might be different in your setup. |
|
I think it would make sense for the Addition functions to automatically convert json elements into strings. This should be a straightforward modification to the parser that would preserve backward compatibility. |
|
added a PR that makes those operations (+, ==, etc.) work backwards so this works fine again
|
|
Parser bumped to 1.8.1. |
(TOOLTIP, expandRoll). This makes headless macros (those that work with h and r roll options) faster as no deterministic AST tree is generated within parser.
Added unit tests for macro branch roll options that previously failed.
Unit testing MapToolLineParser is difficult as it's not truly headless. There are calls to static methods that fail, so I hardened a bit where needed.
fixes #1898
This change is