> thanks for your reply thomas. for me, there is two cases of slowness.
>
> - the rpc is quite slow. i am using it to return a few thousand by
> eleven column of data(String)....
There are probably two issues here, one the speed of the RPC, and the
second the speed of populating the table.
But at issue is the attempt to return 33,000 cells worth of data in
one shot. how much of this data is going to be immediately visible to
the user? How likely is the user to use all of this data immediately?
Does your use case present you the opportunity to fetch this data in
some paged way?
you need to figure out how much of your time is spent with the RPC
(deserialization) and how much is spent rendering the table. I would
be inclined to believe that you are likely to find that most of the
time is actually spent rendering the 33,000 cells. however you do have
some options here.
You can move the rendering into an IncrementalCommand which will draw
a few rows at a time which gives the appearance of a much more
responsive application, and will begin rendering immediately, rather
than waiting until all rows are populated before showing the data on
screen.
If your RPC data graph is pretty large, you could switch away from RPC
and use a JSON data graph with Javascript Overlay types on the client
side. a javascript eval() of the object graph from JSON is quite a bit
(like orders of magnitude) faster than RPC deserialization with very
large object graphs. NOTE your design shouldn't rely on large object
graphs, paging is a much better option.
And as gregor mentioned, if you are profiling your code in hosted
mode, the performance has no correlation with real life. you need to
check the performance in web mode, and remember that something that
happens instantaneously in Firefox or Safari (or chrome) could take
forever in IE (particularly IE6), its javascript engine operates at a
glacial speed when compared to other options.
> thanks again..
good luck
-jason
...but DOM operations on a detached tree is much faster because it
On 16 avr, 08:30, Vitali Lovich <vlov...@gmail.com> wrote:
> I'm pretty sure that's wrong - inserting things into a table, detached or
> not, will still result, AFAIK, in DOM operations.
cannot cause a reflow or repaint (same for display:none DOM subtree).
See http://ajaxian.com/archives/browser-reflows-how-do-they-affect-performance
and in general the articles in http://ajaxian.com/by/topic/performance
(you'd have to understand GWT internals to make use of some of the
advices; for instance, queueing [1] maps to GWT's DeferredCommand --do
not forget to push "pause" in the command queue-- and
IncrementalCommand; and the memoizer can hardly be done as proposed
On 16 avr, 11:50, Vitali Lovich <vlov...@gmail.com> wrote:
> On Thu, Apr 16, 2009 at 4:58 AM, Thomas Broyer <t.bro...@gmail.com> wrote:> >http://ajaxian.com/archives/browser-reflows-how-do-they-affect-perfor...
>
> > On 16 avr, 08:30, Vitali Lovich <vlov...@gmail.com> wrote:
> > > I'm pretty sure that's wrong - inserting things into a table, detached or
> > > not, will still result, AFAIK, in DOM operations.
>
> > ...but DOM operations on a detached tree is much faster because it
> > cannot cause a reflow or repaint (same for display:none DOM subtree).
> > See
>http://ejohn.org/blog/dom-documentfragments/
> I think you need to re-read that. That applies to CSS not Javascript.
> Since Javascript is single-threaded (even with HTML5, DOM manipulation can
> only happen on 1 thread so this is still correct), these will not (at least
> they shouldn't from what I understand of browsers) trigger any reflows or
> repaints until the browser gets control back (when you finishing making all
> your DOM updates or if you use incremental commands).
>
> Thus you shouldn't see any performance benefits over inserting into a
> detached node or an attached node.
and http://www.slideshare.net/julien.lecomte/high-performance-ajax-applications
(slide 33, for example)
(and many other web resources) proves you're wrong.
You seem to be saying that:
tree t = new tree()
t.addItem("abc");
t.addItem("def");
RootPanel.get().add(t);
will have fewer reflows than
tree t = new tree()
RootPanel.get().add(t)
t.addItem("abc")
t.addItem("def")
According to you (at least from what you've said so far) is that the 1st snippet will cause 1 DOM reflow whereas the below snippet will cause 2, which isn't actually the case AFAIK. Both will only cause 1 & will be equally fast.
2009/4/16 Vitali Lovich <vlo...@gmail.com>You seem to be saying that:
tree t = new tree()
t.addItem("abc");
t.addItem("def");
RootPanel.get().add(t);
will have fewer reflows than
tree t = new tree()
RootPanel.get().add(t)
t.addItem("abc")
t.addItem("def")
According to you (at least from what you've said so far) is that the 1st snippet will cause 1 DOM reflow whereas the below snippet will cause 2, which isn't actually the case AFAIK. Both will only cause 1 & will be equally fast.I think you are both right, depending on the browser you are in.FF2 (IIRC) will rerender during a sequence where most other browsers won't. I don't know when it decides to do that, but most other browsers would be still displaying your splash screen while FF2 has hidden it and has stuff dancing about on the screen.
This is overly simplified, but ...
Well lets look at what is happening. every time you create a widget,
you instantiate a javascript object, that object has fields and
methods to support widget behavior, so more javascript object
instantiation, you also call Document.createElement() to create the
element that will ultimately be inserted into the DOM ... now you do
this multiple times because composite widgets are rarely just a single
widget. All of this stuff is done in an interpreted dynamic language ...
Now, getInnerHtml() -> setInnerHTML() no objects are created in
javascript, (well, ok one string is created by the getInnerHTML call)
a single DOM method call is made that passes text to the underlying
browser rendering engine (usually compiled C of some sort) that engine
renders the html and you are done.
Though there have been great strides in Javascript engine performance
in the last year, they still are nowhere near the performance of
compiled C code.
-jason
On Apr 16, 2009, at 10:55 AM, Vitali Lovich wrote:
Under every normal circumstance you would simply develop using
widgets, but that becomes impossible if some use case says you need to
fill a 100,000 cell grid all at once. That sort of thing puts you into
a position where normal GWT development techniques just aren't able to
do the job.
If you are simply displaying (read only) data, there may be no reason
to add all the overhead of a heavyweight object like a widget, and
straight html may be the better option.
-jason
You can do that with IncrementalCommand, but at the end of the day
> 1) Do I need to actually draw all 100 000 widgets at once? Can I
> display a portion of the data & defer the rest for a later point in
> time (perhaps doing it in the background)
you're still going to choke the browser each time this needs to be
displayed.
That's fine, but you still need to create the widget and that's
> 2) Why am I constantly recreating the widget structure instead of
> doing it once and simply changing the data displayed.
what'll take a lot of time. If it takes 20 seconds to log into your
application because you're generating the grid in the background,
that's not going to make your users happy.
thank you for all replies.
i have a few questions:
1) JSON data graph with Javascript Overlay -- i can't find example on
this... can someone tell me what is this?
2) so the rendering of the data is probably the reason why an
application looks slow.....
if the data i want to transfer from
server to client is huge..... should i still be using RPC? or is there
a better method? currently, i am using gwt-rpc to transfer 2d array of
string.....
3 can someone explain to me why the need of JSON and XMl
serialisation? besides the need to communicate with non-java server?