Menu

execution time

Help
Anonymous
2011-06-10
2013-04-20
  • Anonymous

    Anonymous - 2011-06-10

    Dear all,

    I have noticed something unusual while testing my plugin (Tulip 3.6).
    It is an interactor that I'm implementing and part of the code is executed on an independant QThread.
    I have first to initialize weights and I am doing so:

    llWeight = graph->getLocalProperty<DoubleProperty>("LLWeight");
    llWeight->setAllNodeValue(0.0);

    double weight = 0.0;
    node u;
    forEach(u, graph->getNodes())
    {
    weight = 0.0;
    edge e;
    forEach(e,  graph->getInOutEdges(u))
    {
    weight++ ;
    llWeight->setEdgeValue(e,1.0);
    }

    llWeight->setNodeValue (u, weight);
    }

    With a file of 31Mo, this code takes several minutes to executes (up to 12!), despites the subgraph which is of a 60 nodes and 1000 edges… The main graph isn't really big, about 35000 objects, but contains a lot of subgraphs. My problem might come from the fact that I have a great load of double (metric) properties, about 2500.

    The unusual behavior is this happens only the first time I launch my plugin, but whenever I leunch it afterwards, this code is executed instantly.

    Why is it so? Is it because of caching? How can I cut the time of this algorithmic part?

    Tanks a lot!

    Ben

     
  • packadal

    packadal - 2011-06-10

    Hi,

    If this snippet is exactly what you are doing, maybe you could set all edges value at the beginning (because the value you set on the edges never change), and use the degree of the node instead of iterating over the edges.

    Best,
    Charles.

     
  • Antoine Lambert

    Antoine Lambert - 2011-06-10

    Hi,

    Try to add a call to tlp::Observable::holdObservers() before the main loop and a call to tlp::Observable::unholdObservers() after the loop. You have to include <tulip/Observable.h>. I think it will fix your performance issue.

    Antoine

     
  • Anonymous

    Anonymous - 2011-06-22

    Hi,

    @Charles, indeed if I was only doing that, your way would be the best, but the code I gave you was just a part of a prototype, trying to dig into my performance issue, I have reduced it to the form I gave you, which didn't bring any improvement so I called for help.
    @Antoine, I have tried to hold the observers but it's doesn't seem to work.

    The weirdest of all: I launch my plugin first on a graph, it takes time as I told you and the execution is slowed during this simple loop. I launch again the plugin, no more pause in the execution, it's almost done in a second. Now, I don't close Tulip, open a different graph, then launch my interactor… no pause either. I'll try to monitor inside this loop where algorithm is stuck and tell you more… In the meantime, if any of you has an idea about the phenomenon, I'll take your advice!

    Cheers,

    Ben

     
  • Ludwig Fiolka

    Ludwig Fiolka - 2011-06-23

    Hi,

    You should try to run callgrind on your code (with tulip compiled in RelWithDebInfo mode). It would help us identifiying any bottleneck that could lay in the Tulip methods you're calling from your code.

    Cheers

     

Log in to post a comment.