Open samreid opened 11 months ago
I have not been able to make time for https://github.com/phetsims/decaf/issues/134 this iteration. I estimate it would take about half a day to take the new version for a test drive. Then if it a significant benefit, probably 2+ days to bring to production. Would be good to have 2 devs from the beginning, in case we decide to bring it to production. I don’t feel it is a small enough issue to fly under the radar, probably would be best to decide if we want to spend time on it, and schedule for an iteration if desired.
1 reply
Sam Reid
< 1 minute ago
It is still in RC. Not sure we should be a guinea pig. Unclear whether the tech advances translate into practical benefits for our users.
@Marla Schulz
and
@jbphet
agree. Maybe put the issue on hold.
@kathy-phet said:
Re CheerpJ says: We are planning another Release Candidate (3.0rc2) before the end of the year, with a general release scheduled for early 2024. Let's plan to test out rc2 then. We want to have time to report any PhET-specific issues back to CheerpJ
At today's planning meeting, @kathy-phet said this could be a "backlog" issue for @matthew-blackman and @samreid if we have time for it during this iteration, if we happen to have a lull. @kathy-phet said it is ok if there isn't time for it.
From 2/1/24 CheerpJ emails:
We're delighted to announce that CheerpJ 3.0 is now generally available, marking a significant milestone in Leaning Technologies’ vision of running any application on the browser. With CheerpJ 3.0, Java client applications, such as Java Applets, Java Web Start applications, and stand-alone Java Applications, can run unmodified on modern browsers, without a local Java installation. As a valued member of our community, we wanted to ensure you're among the first to know about the features and enhancements that come with this major release. CheerpJ 3.0: The Future of Java in the Browser. With insights gained over 7 years of extensive Enterprise utilization of CheerpJ, we have dedicated the last two years to a full rewrite of CheerpJ. The result of these efforts is CheerpJ 3.0, a complete, secure and modern solution to run Java on the browser. CheerpJ 3.0 is not only more powerful, better performing, and more extensively compatible compared to previous releases, but it is also extraordinarily easy to use. Click below to find out what's new and what it means for your Java Applications. Find out more: https://cheerpj.com/cheerpj-30-now-generally-available/
Ready to experience the future of Java in the browser? CheerpJ 3.0 is ready for you! Head over to LT Labs to explore all the possibilities and make the upgrade. Should you have any questions or need assistance, join our Discord Server. Thank you for being a valued part of our community. We can't wait to see the incredible things you'll achieve with CheerpJ 3.0!
From Stefano:
I would strongly recommend you to explore upgrading to CheerpJ 3.0. You will get faster loading time, and better performance. You will also get better font rendering, but general rendering will look identical to what you get with CheerpJ 2.x, which is what you get in native Java as well. CheerpJ 3.x gets rid of ahead-of-time compilation, making your update and maintenance processes extremely simpler.
You can get started with CheerpJ by having a look at our new Documentation. There's a dedicated guide to migrate from CheerpJ 2.x, but generally speaking the hosting and integration process is quite simple.
Please join our Discord community for support or just to have a chat with the developers of CheerpJ and our community!
Before starting testing 3.0, I'm exercising the existing tool chain to make sure my environment is set up correctly. I got very far but ran into this error:
~/phet/root/perennial$ grunt build-decaf --project=moving-man
Running "build-decaf" task
perhaps the build directory exists
info: Copying /Users/samreid/phet/phet-svn-trunk-2020/simulations-java/simulations/moving-man/deploy/moving-man_all.jar to /Users/samreid/phet/root/decaf/projects/moving-man/build/moving-man_all.jar
copied
starting cheerpjing
Usage: /Applications/cheerpj/cheerpjfy.py file.jar [--deps file1.jar[:files.jar]]
Command exited with status: 1
cheerpjed
awaiting preloads via puppeteer at url = http://localhost/decaf/html?project=moving-man&simulation=moving-man
Fatal error: Perennial task failed with unknown error: Error
This is related to the preload generation step. I thought I recalled someone mentioning this step may not be necessary in 3.0, but I cannot yet find that paper trail.
Here is a snapshot of that failure:
Perhaps it is related to one of these bullet points: https://labs.leaningtech.com/blog/cheerpj-3-deep-dive#how-does-this-compare-to-cheerpj-2x
Notes:
The 3d molecule renders in CheerpJ 2 in the published version but not CheerpJ 3 (on the right is the built version with CheerpJ 3. There is nothing in the console. I've been waiting more than 60 seconds)
Issues
Benefits
Other things to change if we continue:
I consulted with @marlitas and @jonathanolson to ask if the problems listed above should cause us to pause this issue. After discussion we agreed we want to:
This is related to the preload generation step. I thought I recalled someone mentioning this step may not be necessary in 3.0, but I cannot yet find that paper trail.
Yes, from Stefano above "CheerpJ 3.x gets rid of ahead-of-time compilation, making your update and maintenance processes extremely simpler."
I understood ahead-of-time compilation as the preload generation?
Yes, I think that may be the cheerpjfy
step.
For my testing, I have been using the public link to https://cjrtnc.leaningtech.com/3.0/cj3loader.js which has a message at the bottom:
Do we have a license+link to use 3.x?
Looks like even sims with a specified width don't take up the full div:
The documentation at https://labs.leaningtech.com/cheerpj3/reference/cheerpjCreateDisplay#take-up-the-whole-page indicated I could try: cheerpjCreateDisplay(-1, -1, document.body);
but when I did so, I received this error:
java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
cheerpOS.js:1920
cheerpOS.js:1920 at java.lang.Exception.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.lang.RuntimeException.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.lang.IllegalArgumentException.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at javax.swing.RepaintManager.getVolatileOffscreenBuffer(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at javax.swing.RepaintManager.paint(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at javax.swing.JComponent.paint(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.awt.Container.paint(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.awt.Window.paint(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at javax.swing.RepaintManager$4.run(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at javax.swing.RepaintManager$4.run(Unknown Source)
cheerpOS.js:1920
Perhaps the (-1,-1) goes through and hits a runtime error.
UPDATE: Using our own div fixes this.
It seems our way of playing sound is still not supported in 3.0. This is a trace from moving man/unbuilt/macos/chrome.
java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_UNSIGNED 44100.0 Hz, 8 bit, mono, 1 bytes/frame, is supported.
cheerpOS.js:1920
cheerpOS.js:1920 at java.lang.Exception.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.lang.RuntimeException.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.lang.IllegalArgumentException.<init>(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at javax.sound.sampled.AudioSystem.getLine(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at edu.colorado.phet.common.phetcommon.audio.PhetAudioClip.processAudio(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at edu.colorado.phet.common.phetcommon.audio.PhetAudioClip.access$000(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at edu.colorado.phet.common.phetcommon.audio.PhetAudioClip$1.run(Unknown Source)
cheerpOS.js:1920
cheerpOS.js:1920 at java.lang.Thread.run(Unknown Source)
CheerpJ still has rendering imperfections when rendering PSwing style components (Swing component embedded in the 2D piccolo scene graph):
The moving man is very flickery when moving to the right in CheerpJ 3.0 but not in 2.0. This movie is from unbuilt/3.0/mac/chrome:
https://github.com/phetsims/decaf/assets/679486/55846f8f-5d41-4ce1-9109-92fabf466561
After this investigation, I think we should consult with @kathy-phet to see if we want to proceed. If we do proceed, I think the next steps would be:
@kathy-phet would you like to meet to review the progress/status/regressions?
We do have a license with CheerpJ, so we should have a link that avoids that message.
Stefano recommended joining their discord channel - Should you have any questions or need assistance, join our Discord Server. Have you asked any questions there?
Do you see any evidence of improved performance?
We do have a license with CheerpJ, so we should have a link that avoids that message.
Sounds good. Do you know if we have a login on their website to get that link, or do they send that to us? I don't have it. I can ask about it on Discord if you like.
Stefano recommended joining their discord channel - Should you have any questions or need assistance, join our Discord Server. Have you asked any questions there?
Yes, I have been discussing with CheerpJ on the Discord channel. They already fixed a documentation error I pointed out. I shared this issue URL and one of their team members had taken at least a quick look. It was framed more as "I'm in the neighborhood and here's what I'm working on, and some rough findings" rather than "here's a specific problem I'm ready to request help on".
Do you see any evidence of improved performance?
Yes, I noted a performance benefit in https://github.com/phetsims/decaf/issues/134#issuecomment-1969671933 in sugar and salt solutions on screen 1 (though it no longer has the 3d molecule rendering on screen 3). Moving man screen 2 takes about 90ms to render a frame on CheerpJ 2.x and roughly 75ms (with more variability) to render a frame on 3.x, but the man image is flickering in and out when moving to the right.
I messaged the CheerpJ team:
We wanted to clarify about the license key and the runtime specifically regarding privacy concerns. Our CheerpJ project is open source and publicly available at https://github.com/phetsims/decaf, so we did not want to commit the license key or the runtime materials without your advice. What do you recommend?
Next, we published a public simulation using CheerpJ 3.0 here: https://phet-dev.colorado.edu/decaf/sugar-and-salt-solutions/1.0.0-dev.10/sugar-and-salt-solutions.html?simulation=sugar-and-salt-solutions and recorded some performance results. Testing performance on MacBook Air M1 running MacOS 14.2.1 and Chrome Version 123.0.6312.58 (Official Build) (arm64), Measuring time until the sim displays.
CheerpJ 3.0 On the built dev version: https://phet-dev.colorado.edu/decaf/sugar-and-salt-solutions/1.0.0-dev.10/sugar-and-salt-solutions.html?simulation=sugar-and-salt-solutions 18.72s 19.42s 17.43s
CheerpJ 3.0 On my localhost (no remote traffic) http://localhost/decaf/projects/sugar-and-salt-solutions/build/sugar-and-salt-solutions.html?simulation=sugar-and-salt-solutions 6s 5.93s 6.5s
CheerpJ 2.0 On the production version: https://phet.colorado.edu/sims/cheerpj/sugar-and-salt-solutions/latest/sugar-and-salt-solutions.html?simulation=sugar-and-salt-solutions 3.66s 2.83s 2.51s
CheerpJ 2.0 Downloading the prior link to my localhost http://localhost/sugar-and-salt-solutions-dev9/sugar-and-salt-solutions.html?simulation=sugar-and-salt-solutions 2.63s 2.7s 2.71s
Also, our production server phet.colorado.edu is a bit faster than our development server phet-dev.colorado.edu, so that network time will come down. Our main concern is that even when running on localhost to minimize network latency the time to display the CheerpJ 3.0 simulation is still around 2x compared to the CheerpJ 2.0 simulation.
Best Regards, Sam Reid PhET Interactive Simulations
CheerpJ announced 3.0 in https://leaningtech.com/announcing-cheerpj-3-0rc1-help-us-test-and-improve/. @kathy-phet asked: