Skip to content

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Aug 14, 2025

Pull Request Description

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • benchmark run is OK

@JaroslavTulach JaroslavTulach self-assigned this Aug 14, 2025
@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Aug 14, 2025
@JaroslavTulach JaroslavTulach requested a review from 4e6 as a code owner August 15, 2025 07:31
static byte[] writeObject(PerMap map, Object obj, Function<Object, Object> writeReplace)
throws IOException {
var histogram = PerUtils.LOG.isLoggable(System.Logger.Level.DEBUG) ? new Histogram() : null;
var histogram = PerUtils.LOG.isLoggable(System.Logger.Level.TRACE) ? new Histogram() : null;
Copy link
Member Author

@JaroslavTulach JaroslavTulach Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • this change suppresses histogram (of transfered bytes) printing in the "dual JVM"
  • by printing less, the message exchange shall get faster: benchmark run
  • the big question for @hubertp: How to configure logging in the "dual JVM"?

@JaroslavTulach
Copy link
Member Author

Time to reduce the histogram of sent messages...

* runEngineDistribution
* --vm.D=org.enso.jvm.interop.limit=100000
* --vm.D=polyglot.enso.classLoading=guest
* --run test/Generic_JDBC_Tests
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since f0ded99 use:

runEngineDistribution  
  --vm.D=org.enso.jvm.interop.limit=100000 
  --vm.D=polyglot.enso.classLoading=guest
  --run test/Generic_JDBC_Tests

to dump the top 10 of most frequent messages being sent.

yield new OtherJvmObject(null, id);
var other = new OtherJvmObject(null, id);
other.isMetaObject = iop.isMetaObject(foreign);
other.isNull = iop.isNull(foreign);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefilling isMetaObject and isNull before leaving the other JVM should speed things up: benchmark run scheduled to verify the hypothesis.

data.bench_tests 1 [ "--vm.D=polyglot.enso.classLoading=guest", single_test_filter ]
group_builder.specify "Single_Dual_JVM_Tests" <|
data.bench_tests 1 jvm=True [ "--vm.D=polyglot.enso.classLoading=guest", single_test_filter ]
group_builder.specify "Real_JVM_Tests" <|
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the "real" test that occupies most of the Generic_JDBC_Tests execution. It used to be quite slow. Now it is just six times slower than the one in --jvm mode. Time to generate the initial benchmark data.

}
case TruffleObject foreign -> {
var iop = InteropLibrary.getUncached();
if (iop.isString(foreign)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transferring strings directly shall allow us to eliminate isString messages in fc4ff25 - benchmark run to confirm.

private Boolean isNull;
private Boolean hasArrayElements;
private final short mask;
private String metaQualifiedName;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing all the Boolean fields by a single short mask in 4c8ef7c. Benchmarking in this run.

@JaroslavTulach JaroslavTulach added the CI: Keep up to date Automatically update this PR to the latest develop. label Aug 19, 2025
@JaroslavTulach JaroslavTulach changed the title Bechmark various JVM modes on execution of Generic_JDBC_Tests Bechmark and speed various JVM modes up Aug 19, 2025
@JaroslavTulach JaroslavTulach moved this to 🔧 Implementation in Issues Board Aug 19, 2025
@JaroslavTulach JaroslavTulach moved this to 🔧 Implementation in Issues Board Aug 19, 2025
@JaroslavTulach JaroslavTulach added this to the 2025.3 Release milestone Aug 19, 2025
@JaroslavTulach JaroslavTulach added -compiler and removed CI: Keep up to date Automatically update this PR to the latest develop. labels Aug 19, 2025
@JaroslavTulach
Copy link
Member Author

JaroslavTulach commented Aug 19, 2025

  • the last benchmark run shows acceptable state and also some progress
  • the most important set of benchmarks is the Real test execution
  • it shows improvement - from 50-60s to 20-30s
real benchmarks
  • that's still way slower than 11s when executed with --jvm
  • but it is "bearable"
    • it is not hideously slow
    • we have infrastructure to track progress
  • I think we can integrate

@JaroslavTulach JaroslavTulach changed the title Bechmark and speed various JVM modes up Bechmark and speed dual JVM mode up Aug 19, 2025
@github-project-automation github-project-automation bot moved this from 🔧 Implementation to 🌟 Q/A review in Issues Board Aug 19, 2025
@JaroslavTulach JaroslavTulach changed the title Bechmark and speed dual JVM mode up Benchmark and speed dual JVM mode up Aug 19, 2025
@JaroslavTulach JaroslavTulach merged commit 1d702ef into develop Aug 19, 2025
87 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/BenchmarkJvmModes branch August 19, 2025 12:22
@github-project-automation github-project-automation bot moved this from 🌟 Q/A review to 🟢 Accepted in Issues Board Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

-compiler CI: No changelog needed Do not require a changelog entry for this PR.

Projects

Status: 🟢 Accepted

Development

Successfully merging this pull request may close these issues.

4 participants