-
-
Notifications
You must be signed in to change notification settings - Fork 141
Change and normalize object instantiation in C++ #416
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
Conversation
…ray of jvalue add working object instantiation in cpp refactor unused and unaccessed code add constructor caching with the updated structure
💚 |
(debug config - please ignore)
*both args passed are reference types |
@Pip3r4o So, the benchmarks show that we are actually getting slower with this pull? What's the benefit then? The Runtimes should be extra cautious about performance, especially in Android. Btw, I wonder why is this slower? Moving the logic to C++ implies that it would get faster. Could it be that still some work is done in Java and it is the marshaling transitions that make the difference? |
@atanasovg I am still trying to pinpoint the exact reason(s) for the discrepancies. For one, I know that once all candidate constructors are found in Java, we do one additional conversion (again in Java) to confirm arguments match with the best candidate, which could be dropped out, but I have yet to test whether there'd be side effects to that. Previously arguments were being converted only before resolving constructor in Java land, and one more time as confirmation, in Java. I'll see if dropping either of the two additional arg conversions will make a difference. |
@atanasovg I'd like to add that the above tests were performed in debug configuration, which I hadn't noticed earlier. I am happy to say that with the removal of the redundant conversions, the latest benchmarks show that the changes account for slightly better performance than what we had before, and perform as fast as the previous version when there are one or more arguments.
|
👍 @Pip3r4o Me likes this 😄 |
👍 |
💚 |
@Pip3r4o, looks great 👍 |
💚 |
Changed object instantiation to happen in the C++ code instead of Java in order to normalize constructor/method invocations.
Like methods, constructors are resolved in Java and their signatures cached in C++, where we make instances of Java objects. This means that arguments will be converted the same way for both methods and constructors.
ping: @Plamen5kov, @slavchev