danilw / cputests

wasm/javascript/java/C++ tests
GNU General Public License v3.0
13 stars 1 forks source link

The comparison between Javascript and Java is biased as the (faster) retained mode is used with the former and not with the latter #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

The vertices are stored in a ThreeJS geometry in the Javascript version, WebGL is used under the hood which doesn't support immediate mode whereas the Java version uses immediate mode (glVertex3f) which is a lot slower where as all major Java bindings to the OpenGL API support the retained mode and actually, all major Java scenegraph APIs since Java3D use the retained mode. That's why I think it would be more "fair" to compare comparable things by using the retained mode both in Javascript and in Java.

danilw commented 7 years ago

it was writen using Opnegl2 API

I can rewrite it using GLSL only it will be same speed everywhere(2x slower in browsers becuase glsl in browsers...slower for some reason)

my example show "how slow memory transfer" in javascript (javascript->webbrowser webgl parse->OpenGL)"

when same transfer in "java" are Much faster

java3d...bro its even older then me.... maybe you mean javaFX

ghost commented 7 years ago

The immediate mode is supported by OpenGL since its version 1.0. The retained mode is supported by OpenGL since its version 1.1: https://en.wikipedia.org/wiki/OpenGL#OpenGL_1.1 https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_vertex_array.txt

Java3D uses the retained mode and JavaFX 3D too.

I just suggested to use the VBOs instead of glVertex...() in the Java source code so that the comparison with the Javascript source code already using them is more "fair".

danilw commented 7 years ago

thanks for you info :)

next OpenGL test il write using "actual" technologie like GLSL (webbrowsers has no suport for Opengl4+), all previous code is an fast example of "bad and unoptimized way"

I do not like write "good super fast optimized C/java code" and then rework it to make it "work under javascript" (which has alot of limitations... I not even use threads or more obvious ways to make it much faster on everythink else then javascript) this why I write like "copy paste" with most closest replaycement for functions in each language