Canvas drawing performance optimization [message #651630] |
Mon, 31 January 2011 18:36  |
Eclipse User |
|
|
|
Hi,
I wanted to have some advice concerning performance optimization when
using the canvas to draw real-time graphs. My application displays
real-time graphs that are refreshed every second. Each refresh triggers
an http request from the server that is about 500KB in size. I noticed
that the UI could be more reactive when these graphs are being
refreshed (especially when more than one user is logged into the app -
note: the RCP application, while single user, doesn't have any
performance issue). So my first question is: does it make sense to
render these graphs as bitmap instead of using the canvas? The bitmap
itself might be smaller than the http request and might potentially
consume less CPU on the browser. Does anyone have any experience doing
such optimization? Is it worth considering it or is the canvas
implementation in RAP going to be improved soon (or is there something
else I can do in my code)?
Thanks,
Jean Bovet
|
|
|
Re: Canvas drawing performance optimization [message #652247 is a reply to message #651630] |
Thu, 03 February 2011 05:26  |
Eclipse User |
|
|
|
Hello.
> real-time graphs that are refreshed every second. Each refresh triggers
> an http request from the server that is about 500KB in size. I noticed
That is an unusual size for a canvas graphic. Its indicating that it
simply is above the level of complexity that our canvas implementation
can handle at such a high refresh-rate. Whats the nature of your graph?
Could you give a screenshot?
> So my first question is: does it make sense to render these graphs as
> bitmap instead of using the canvas? The bitmap itself might be smaller
> than the http request and might potentially consume less CPU on the
> browser. Does anyone have any experience doing such optimization? Is it
I think we experimented with a similar concept once and found it was
very heavy on the server. In the browser it might be faster or slower,
that probably relies on too many variables to be sure.
> worth considering it or is the canvas implementation in RAP going to be
> improved soon (or is there something else I can do in my code)?
The canvas implementation in RAP will most likely not be essentially
changed anymore. We are investigating the possibility of implementing
Draw2D in a way that would be more efficient that drawing directly on
the canvas. However, this probabably wont happen very soon.
Regarding any optimizations to your code: Try reduzing the number of
drawing-operations, for example by leaving out decorative elements. Try
preventing drawing-operations that overlap each other. If you have a
static background, you could try setting it as a background-image on the
canvas instead of drawing it with GC.
Hope that Helps.
Greeetings,
Tim
|
|
|
Powered by
FUDForum. Page generated in 0.03055 seconds