dragome / dragome-sdk

Dragome is a tool for creating client side web applications in pure Java (JVM) language.
http://www.dragome.com
Other
80 stars 20 forks source link

StringBuilder is very slow #177

Open neuronsupport opened 7 years ago

neuronsupport commented 7 years ago

For string concatenation which is faster with Dragome? StringBuilder does not seem to be fast. It uses array and uses array push for append. Is concat method of String faster? what do you recommend?

neuronsupport commented 7 years ago

StringBuilder uses array for concatenation. This is very slow. GWT uses plain javascript strings with StringBuilder. I would recommend taking the GWT approach instead of array.

neuronsupport commented 7 years ago

https://jsperf.com/string-concat-vs-array-join-10000/2

neuronsupport commented 7 years ago

"ScriptHelper.eval*", is this really javascript eval? Or dragome creates raw javascript method for it?

fpetrola commented 7 years ago

Hi @norzak sorry for the delay, ScriptHelper in general creates raw js for eval, but in some particular cases, for example when you are not using a constant string as parameter it uses eval.

fpetrola commented 7 years ago

It seems it could easy to use gwt implementation: https://github.com/gwtproject/gwt/blob/master/user/super/com/google/gwt/emul/java/lang/StringBuilder.java We can try it

neuronsupport commented 7 years ago

Great. I agree.