Am Donnerstag, 6. August 2015, 14:00:27 schrieb Rahman USTA: > @Mike > > JRuby brings me ~ +30 MB. I tried to use Nashorn also but it is so slow. > I'm thinking to continue with WebView. > > The question is why there is HTML 5 Web Workers. Why there is no like that > for JavaFX threading model. > > @Jens > > Expensiveness comes from JavaScript code that runs on UI thread. Script > execution takes long time normally. For example docbook conversion > execution starts from here > https://github.com/asciidocfx/AsciidocFX/blob/master/src/main/java/com/kodcu > /component/HtmlPane.java#L56
i would replace: JSObject result = (JSObject) webEngine().executeScript(String.format("convertDocbook(editorValue,docbookOptions)")); return .... with: CompletableFuture<JSObject> future = CompletableFuture.supplyAsync( () -> { return (JSObject) webEngine().executeScript(String.format("convertDocbook(editorValue,docbookOptions)")); } ); return new ConverterResult(future); <<< you should check if future is present change your method an provide a consumer to call on completion an do not return the result (would be better) -- Jens Kapitza