#11 The DOM is too slow

closed-fixed
General (42)
5
2006-04-22
2006-03-01
No

The DOM takes minutes to load large models. It seems to
me that there are some serious performance issues.
Loading the same file with libxml or any other xml
library takes only a few seconds, so it seems that the
DOM is doing extra work and consuming too much time.
I'm under the impression that most of the time is spent
doing database lookups, uri resolution and floating
point conversion, but I haven't done any accurate
profiling. I'll send some example files privately.

Discussion

  • Andy Lorino

    Andy Lorino - 2006-03-02

    Logged In: YES
    user_id=1434587

    The latest version here on svn has a fix that makes
    daeSTLDatabase::getElement() about 3x faster.

     
  • Ignacio Castańo

    Logged In: YES
    user_id=583871

    Thanks! that after that change most of our models load in
    less than two seconds.

     
  • Andy Lorino

    Andy Lorino - 2006-03-31

    Logged In: YES
    user_id=1434587

    After working closely with Ignacio's team we were able to
    make considerable speed increases.
    I know this bug is very general and the DOM can probably be
    made faster but I hope others benefit from the work done.

     
  • Andy Lorino

    Andy Lorino - 2006-03-31
    • status: open --> open-fixed
     
  • Brent

    Brent - 2006-04-10

    Logged In: YES
    user_id=1437244

    As written, daeSTLDatabase::removeCollection() is extremely
    slow. A simple optimization took my model load time from 24
    seconds down to 12 seconds. Here is the optimized version
    of the function:

    daeInt daeSTLDatabase::removeCollection(daeCollection
    *collection)
    {
    // Copy the elements that are not in this collection into
    // a new list.
    std::vector<DAE_STL_DATABASE_CELL> newElements;
    newElements.reserve(elements.size());

    std::vector<DAE_STL_DATABASE_CELL>::iterator iter =
    elements.begin();
    while ( iter != elements.end() ) {
    if ( (*iter).collection != collection ) {
    newElements.push_back(*iter);
    }
    iter++;
    }
    // Replace our existing element list with the new one (that
    is missing
    // the elements from this collection).
    elements = newElements;

    //remove the collection from its vector
    std::vector<daeCollection*>::iterator iter2 =
    collections.begin();
    while ( iter2 != collections.end() ) {
    if ( (*iter2) == collection ) {
    iter2 = collections.erase(iter2);
    }
    else {
    iter2++;
    }
    }
    return DAE_OK;
    }

     
  • Andy Lorino

    Andy Lorino - 2006-04-22
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.