WebView Performance in JavaFX

I have HTML5 UI and Java backend, and I want to not rebuild HTML ui in plain Java, so my idea was to start a local web server and use webview to render in a "native" window. The solution is similar to using JavaFX WebView, which can be built into swing. On paper, this sounds great (especially because they claim to use WebKit, which has significantly better performance for my interface in Chrome / Safari).

This works, but: performance is REQUIRED. Orders of magnitude are slower than the same in Chrome, Safari (or even slow Firefox). This is literally unusable (my user interface uses jQuery / JS very much). Btw, I am using the code for this post .

The question arises:

  • Can someone repeat my experience? Am I just doing something wrong or is it caused by JavaFX and therefore "normal"?

  • How to better understand how to achieve this? I am currently just launching a system browser that works, but not as good (doesn't look like integrated).

+32
java performance swing javafx webview
May 26 '12 at 1:29
source share
5 answers

I used WebView quite a bit, and usually the performance was great and very convenient.

  • Html5 compatibility is good.
  • JavaScript performance varies, but I found about a third of the speed of the latest version of Chrome according to the Google V8 benchmark (which Chrome apparently seems to be tuned for).
  • Rendering performance was not a big problem.
  • Very intense HTML Webapps, such as some of the Chrome experiment library, did not start as fast as in some other browsers.
  • WebGL is not supported, so sites that return to software rendering graphics from WebGL are much slower.

The biggest problem I encountered in WebView is that it is not so stable for advanced features and intensive use as other browsers, but does not cause serious performance problems.

Here are a few benchmarks (the version of WebView used was obtained from JavaFX 2.2 build 9):

Conformity

Running the html5 test to verify html5 compliance (out of 500 ratings):

 Chrome 19 402 + 13 bonus points
 Firefox 12 345 + 9 bonus points
 WebView 2.2b9 296 + 7 bonus points 
 IE 9.0.6 138 + 5 bonus points

Running the acid3 test, browsing 100/100 web pages is similar to other test browsers, but like IE9, the final rendering has a slight imperfection.

Javascript

Sunspider Javascript Test (lower is better):

 IE 9.0.6 146.7ms 
 Chrome 19 151.5ms
 Firefox 12 185.8ms
 WebView 2.2b9 199.5ms 

Google V8 Javascript Test (Higher, Better):

 Chrome 19 15323
 Firefox 12 9557
 WebView 2.2b9 5145
 IE 9.0.6 3661

Mozilla Kraken Javascript Test (lower is better):

 Chrome 19 2416.8ms
 Firefox 12 2112.9ms
 WebView 2.2b9 7988.9ms
 IE 9.0.6 9403.0ms

Intense canvas

Spinning 3D Buddha (better):

 Chrome 19 60fps
 Firefox 12 43fps
 IE 9.0.6 16fps
 WebView 2.2b9 7fps

JQuery

JQuery test suite (lower is better):

 Chrome 19 21826ms
 WebView 2.2b9 22742ms
 Firefox 12 23554ms
 IE 9.0.6 28247ms

Based on the tests above (work on my Windows 7 desktop), while WebView is stable and functional enough for you, then the performance of WebView and other browsers should not be a problem (as long as your application does not have many 3D spinning buddhas ...: - )

Update

As uta response states, the JavaScript JIT compiler is included to create a 32-bit build of WinForm 2.2 and to build a 64-bit version of WinForm 2.2 in JavaFX 2.2. This means that WebView JavaScript tests are significantly slower (usually 4-5 times slower) when running the 64-bit version of JavaFX and the 32-bit version of JavaFX.

+41
May 26 '12 at 2:56
source share

JavaScript JIT is disabled in WebNode for Windows x64. This may be the cause of your problem.

+8
Jul 25 '12 at 12:25
source share

I also encountered poor JavaFX WebView performance (slowness, redrawing) for my site ( https://mdemo.cqg.com ). After some googling, I came across the topic Integrating JavaFX 2.0 WebView into a Swing Java SE 6 application . Among the answers is a suggestion to use JxBrowser ( http://www.teamdev.com/jxbrowser ) - a Swing / JavaFX component based on Chromium for Java. I tried this for my site. The site is well done - not slowness and does not redraw the problems (which occur in the original WebView).

+6
Jun 18 '15 at 15:45
source share

You are not alone in this situation. I still have problems with webview and google maps. You can see the link below. At the moment, I have no answer for you, and it is very unpleasant, I know ...

Some examples of my post: - https://community.oracle.com/message/12356161

Simplify this if you can: - https://javafx-jira.kenai.com/browse/RT-33217

+5
Apr 04 '14 at 12:09 on
source share

One of the reasons that the JavaFX web browser looks slower is because, unlike a web browser, it caches nothing. This must be done.

+4
Jul 29 '13 at 7:03
source share



All Articles