Hi George,

thanks for your suggestions!
I opted to change the list to an array and this brought about a huge
increase in performance - down to 30 seconds from 3 minutes!


On Oct 18, 5:09 pm, George Georgovassilis <[email protected]>
wrote:
> Hello BurstUser,
>
> You need to keep in mind that the returned code is not parsed into
> javascript object by some mechanism that is native to the browser. The
> returned string is parsed in javascript, so it is not uncommon that
> complex objects take several seconds to parse. I've run into this
> problem on several occasions and depending on the severity found two
> solutions that worked for me:
>
> 1. change the list into an array and see if that gets parsetimes into
> an acceptable range
> 2. return a single, delimited string and split it appart on the client
> with a regular expression.
>
> On Oct 18, 2:46 pm, BurstUser <[email protected]> wrote:
>
>
>
> > Hi all,
>
> > I'm having issues with a very slow AsyncCallback method.
>
> > My set up is as follows:
>
> > // CLIENT CODE:
>
> > System.out.println("ONE:  "+System.currentTimeMillis()/1000F);
> > final AsyncCallback callback  = new AsyncCallback(){
> >     public void onSuccess(Object result){
>
> >         System.out.println("THREE:  "+System.currentTimeMillis()/
> > 1000F);
>
> >         dataList = (List<String>) result;
> >         createTable(dataList);
> >     }
> >     public void onFailure(Throwable caught){
> >         Window.alert(caught.toString());
> >     }
> >     //Call to openFile service on server
> >     fileService.openFile(fileType,fileName,callback)
>
> > }
>
> > // SERVER SIDE CODE:
> > public List<String> openFile(int fileType, String fileName){
> >     File file = new File(fileName);
> >     FileInputStream fin = null;
> >     byte[] bytes = new byte[(int) file.length()];
> >     try{
> >         fin = new FileInputStream(file);
> >         fin.read(bytes);
> >         String s = new String(bytes);
> >         doStuff(s);
> >         fin.close();
> >     }catch(FileNotFoundException fnfe){
> >         fnfe.printStackTrace();
> >     }catch(IOException ioe){
> >         ioe.printStackTrace();
> >     }
>
> >     System.out.println("TWO:  "+System.currentTimeMillis()/1000F);
>
> >     return dataStringList;
>
> > }
>
> > I'm running the application in development mode.
> > The openFile() method on the server returns an ArrayList<String>
> > called dataStringList, which has 57217 String objects within it.
>
> > My console output is:
> > ONE:    1287402660233
> > TWO:    1287402660597
> > THREE:  1287402836619
>
> > The elapsed time between the System.out.print statements, ONE and TWO
> > is 0.364 seconds.
> > In contrast, the elapsed time between TWO and THREE is 176 seconds
> > (close to 3 minutes), which is far too long for simply processing a
> > file of 164kb in size.
>
> > When I run the application with a smaller data set - with a file size
> > of 4kb - the elapsed time between TWO and THREE is 1.03 seconds.
>
> > Any pointers or suggestions as to where the time lag could be would be
> > much appreciated.
> > Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to