[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m

From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print
Date: Fri, 13 Jan 2023 22:16:32 -0500 (EST)

Follow-up Comment #8, bug #63646 (project octave):

For the example in this report, the nested loops in the following code in
octave_polygon::reconstruct end up calling mergepoly around 52 million times
(if I understand, correctly, it would be (10200^2-10200)/2 == 52014900 calls).
 That appears to be what takes all the time and the result for this example is
that no merges ever happen.  I guess that's good though, because if any merge
is detected, the whole loop will be executed again, and in the worst case, as
few as one polygon might have been added to the unused list.  Is there a
better way to do this job other than by an exhaustive search?  How important
is it to merge the polygons?  Could we make it optional?

    bool tryagain = (m_polygons.count () > 1);

    while (tryagain)
        tryagain = false;
        for (auto ii = 0; ii < m_polygons.count (); ii++)
            if (! unused[ii])
                QPolygonF polygon = m_polygons[ii];
                for (auto jj = ii+1; jj < m_polygons.count (); jj++)
                    if (! unused[jj])
                        QPolygonF newpoly = mergepoly (polygon,
                        if (newpoly.count ())
                            polygon = newpoly;
                            m_polygons[ii] = newpoly;
                            unused[jj] = true;
                            tryagain = true;


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]