Re: float[] is super slow

2017-02-07 Thread Colin Alworth
There are other problems too, like supporting object instanceof float[] (or 
even instanceof Object), not that you likely do a lot of things like that. 
I had a patch once upon a time that would let you optionally use typed 
arrays _or_ js lists as primitive arrays (except longs of course), but it 
added small runtime costs in odd places, so was turned down (outside of the 
code review, separate discussion).

The patch is old and stale, but its possible you could do something with 
it, at least for a personal gwt branch. 
https://gwt-review.googlesource.com/#/c/8321/

There is another option too, depending on how this data looks in your array 
- consider java.nio.FloatBuffer. GWT can get support for it from PlayN 
(backed by js typedarrays, as you would expect), I have experience with it 
and have found you can get pretty amazing performance using it). This is 
still cross platform, won't mess with instanceof, only downside is that 
you'll have to do some not-so-cross platform stuff to interact with the 
typedarray side if you need (serializing, writing to canvas, etc). If you 
need more info, let me know, I have a few projects that use it. PlayN is 
still moving forward, just released their 2.0-rc4, and I've found that the 
buffer impls all behave as expected still.

On Monday, February 6, 2017 at 6:09:33 AM UTC-6, Jens wrote:
>
>
> The reason I'm asking is because Super-source solution can not change all 
>> "new int[...]" invocations in my program. 
>> As far as I understand, the SS solution can change some ArrayFactory and 
>> each time I need to use it I have to write ArrayFactory.createFloatArray. 
>> "new float[]" will not be altered with souper-source.   
>>
>> Am I right ?
>>
>
> yes you would need a factory with super source so you can change the way 
> the array is created.
>
> -- J. 
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: float[] is super slow

2017-02-06 Thread Jens


> The reason I'm asking is because Super-source solution can not change all 
> "new int[...]" invocations in my program. 
> As far as I understand, the SS solution can change some ArrayFactory and 
> each time I need to use it I have to write ArrayFactory.createFloatArray. 
> "new float[]" will not be altered with souper-source.   
>
> Am I right ?
>

yes you would need a factory with super source so you can change the way 
the array is created.

-- J. 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: float[] is super slow

2017-02-06 Thread Kirill Prazdnikov
The reason I'm asking is because Super-source solution can not change all 
"new int[...]" invocations in my program. 
As far as I understand, the SS solution can change some ArrayFactory and 
each time I need to use it I have to write ArrayFactory.createFloatArray. 
"new float[]" will not be altered with souper-source.   

Am I right ?

Thanks

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: float[] is super slow

2017-02-06 Thread Jens


> How can I personally patch the compiler to use Float32Array Int8Array, 
> Int16Array, Int32Array, e,t,c ?
> Is it super-hard ?
> Is there a single place that generates new basic type array ?
>

I think easiest solution would be to implement an "optimization pass" on 
the JavaScript AST. You would need to add that pass to:

https://github.com/gwtproject/gwt/blob/master/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java#L304

We have once done the same by adding an "optimization" pass that had 
wrapped everything in try / catch blocks for Safari to prevent a JIT bug.

-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: float[] is super slow

2017-02-06 Thread Kirill Prazdnikov
OK thanks.

How can I personally patch the compiler to use Float32Array Int8Array, 
Int16Array, Int32Array, e,t,c ?
Is it super-hard ?
Is there a single place that generates new basic type array ?
If it is possible I could deploy the patched version to our company local 
repository.

Thanks

понедельник, 6 февраля 2017 г., 12:37:32 UTC+3 пользователь Jens написал:
>
>
> There is an ugly workaround (which breaks portability, yes I write 
>> portable client code (iOS, Android)):
>>
>
> To make it portable use GWT super source. So in your main code you create 
> a normal float array and in GWT super source you create the Float32Array 
> instead. Then you publish myilb.jar and mylib-gwt.jar (containing the 
> *.gwt.xml file and super source files).
>
> I am not so sure that the Google GWT team will add new features to the 
> compiler given that they are focused on J2CL and internal customers for 
> quite some time now.
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: float[] is super slow

2017-02-06 Thread Jens


> There is an ugly workaround (which breaks portability, yes I write 
> portable client code (iOS, Android)):
>

To make it portable use GWT super source. So in your main code you create a 
normal float array and in GWT super source you create the Float32Array 
instead. Then you publish myilb.jar and mylib-gwt.jar (containing the 
*.gwt.xml file and super source files).

I am not so sure that the Google GWT team will add new features to the 
compiler given that they are focused on J2CL and internal customers for 
quite some time now.

-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.