-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Karate 1.4 takes significantly longer to run tests than 1.2 #2329
Comments
related issue to investigate: https://stackoverflow.com/a/76285986/143475 recommendation is to use Java instead of JS functions where possible. one suggestion to help you troubleshoot is place some obvious logging around the lock and then you can scan the logs to see how many times - and where in your tests it is invoked. for example, if you do will investigate, but this may take a while. I would recommend refactoring to Java, it may needed only for a few hotspots, most likely utility functions you may be using @ericdriggs |
To summarize concurrency issue PolglotContextImpl::throwDeniedAccess is called when multi-threaded access occurs for languages which don't have isThreadAccessAllowed == true
public abstract class TruffleLanguage Language implementation in graal-js doesn't override this value, so concurrent access throws. It's possible to either fork/hard-code override this implementation, or to register a new version of js language which allows multi-threaded access, but doing so isn't supported and may introduce additional concurrency issues because graal is intentionally not thread safe because
...
see also:
https://tc39.es/ecma262/#sec-execution-contexts Relevant Workarounds: It seems that karate is currently using B. It seems that if A is possible through use of deep copies or java objects, this would eliminate almost all concurrent access. |
@ericdriggs cc @joelpramos I hope I've figured out a reasonable solution. here we are discussing JS functions:
would be great if you build locally and test |
@eugeniooliveira would you be able to build locally and check if this solves the problem you reported here: https://stackoverflow.com/q/76284686/143475 |
another related conversation and fix attempt in the past: #2222 |
all: note that 1.4.1.RC3 is available in maven central for those who would like to test this |
@ptrthomas Not sure why karate 1.2 seems to have strictly better performance in JS than the latest version, but that's an extremely compelling case to not upgrade. |
@ericdriggs no, actually most functions will NOT need |
1.4.1 released |
@ericdriggs @joelpramos FYI about our intent to create a lightweight JS engine from scratch to replace Graal: https://twitter.com/ptrthomas/status/1775754727700996381 can't wait to get rid of 60MB of the JARs and get the exact behavior we want |
Good stuff - makes lot of sense. Hopefully you can keep some sort of backwards compatibility / common interfaces as if one day Graal - or another one - is back on the table as an option. I always thought that the potential was there to allow exploring bringing NodeJS packages onto Karate and/or porting Karate into node etc. |
Bravo, bravo, bravissimo! |
@ptrthomas
Karate 1.4 is still significantly slower than 1.2 for large projects.
We're seeing between a +20% to +100% increase in time to run tests.
Haven't yet been able to identify most common examples of why tests are running longer.
If I run a benchmark on 1.2 vs 1.4 I'll submit results here
Likely related to synchronization in:
#2204
Not sure if possible to do a deep copy of context to minimize synchronization code.
The text was updated successfully, but these errors were encountered: