On 4 mar, 06:10, Kevin Tarn <kevn.t...@gmail.com> wrote:
> Unfortunately, using JsArrayInteger is very slow:
>     public byte[] getBitmap() {
> //        String str = getImageData(0, 0, width, height);
> //        byte[] ar = new byte[str.length()];
> //        for (int i=0; i<ar.length; i++)
> //            ar[i] = (byte)((int)str.charAt(i) & 0xff);
> //        return ar;
>          JsArrayInteger ja = getImageRawData(0, 0, width, height);
>          int len = ja.length();
>          byte[] ar = new byte[len];
>          for (int i=0; i<len; i++)
>              ar[i] = (byte)(ja.get(i) & 0xff);
>          return ar;
>     }
>
> The loop above copying element to a byte array is 10 times above than the
> commented codes. Anything doing wrong?

If you're comparing runs in hosted mode, it doesn't really surprise
me, as JsArrayInteger will go back and forth from Java to JavaScript.
But once compiled into JS it should run (almost) at the same speed.

Now, it also depends how getImageRawData has been changed to return a
JsArrayInteger instead of a String...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to