[OpenMap Users] Optimizing Performance

From: Ruben DF <rdocasalf_at_gmail.com>
Date: Fri, 13 May 2011 15:17:45 +0200

Hi all,

First of all, I'm so sorry for my two previous mails. I think I clicked
accidentally and mails were sent.

Despite having written some improvements to optimize the performance
(picking them up from several mails from openmap mailing list), my app
continues having a low performance. I'm gonna write what I did in case
anyone could help me (I'm using Openmap 4.6):

    * I'm using BufferedLayerMapBean instead of using by mapBean by default.
    * I'm using a set of layers (some of them are statics, others very
active layers).
    * The statics layers are taken from openmap.properties and the
background flag as true.
    * The active layers inherit from OMGraphicHandlerLayer and I'm using
this code when inits

           setProjectionChangePolicy(new
com.bbn.openmap.layer.policy.StandardPCPolicy(this, true));
           setRenderPolicy(new
com.bbn.openmap.layer.policy.BufferedImageRenderPolicy());// I added this
line to improve the performance

    * I'm using the omGraphicList by default:
           omlist = layer.prepare();
           omlist.add(elements);
           layer.setList(omlist);

    * I have a dedicated thread to paint each 40 ms approx. and I do this:

        if(omList1!=null){
            omList1.generate(mapBean.getProjection());
        }
                ......
                ......
        if(omListN!=null){
            omListN.generate(mapBean.getProjection());
        }

          mapBean.setBufferDirty(true);
          mapBean.setDoubleBuffered(true);
          Rectangle r = mapBean.getBounds();//Limits of mapBean
          mapBean.repaint(r); //In order to paint just what I'm looking in a
given moment (i don't know wheather this is o not correct)
     * I have this commmands when execute my app:

        -Djava2d.opengl=true
                -Dsun.java2d.pmoffscreen=false

My computer is a Intel Xeon (2 processors at 2Ghz) and RAM 3GB. I'm aware of
the rate is quite high (25hz) to refresh, but the problem is that the cpu
usage is practically the same with these improvements I mentioned before
(about 70% cpu) and I don't know what I can do to solve it. It's clear that
if the thread sleeps for more milliseconds, the cpu usage decreases, since
there are less call to repaint(). Perhaps I'm doing something wrong with my
code.


--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri May 13 2011 - 09:19:02 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:10 EDT