On Thu, 27 Jan 2005 17:15:53 -0500, mental@...3... <mental@...3...> wrote:
That is not normally a performance issue, but for a document like this the loader's abuse of the O(n) sp_repr_append_child() for every individual element multiplies that small extra cost by a very large number. [ it should have built a reversed list of children and then prepended them, as prepending is O(1) ]
I think I am going to commit some code tonight that will also make appending children an O(1) operation, since many people seem to have historically used sp_repr_append_child() without thinking about its cost.
I think that should help. Here are some interrupts during load, at random moments:
Program received signal SIGINT, Interrupt. [Switching to Thread 1087741248 (LWP 10532)] 0x081d81d4 in Inkscape::XML::SimpleNode::lastChild (this=0x82d71d8) at xml/simple-node.cpp:139 139 child = child->next(); Current language: auto; currently c++ (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x081d81d4 in Inkscape::XML::SimpleNode::lastChild (this=0x82d71d8) at xml/simple-node.cpp:139 139 child = child->next(); (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x081d428d in virtual thunk to Inkscape::XML::SimpleNode::next() () at xml/simple-node.cpp:32 32 SimpleNode::SimpleNode(int code) (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x081d429a in Inkscape::XML::SimpleNode::next (this=0xc28c350) at simple-node.h:57 57 SPRepr *next() { return _next; } (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x08102195 in sp_object_attach_reref (parent=0x8527a48, object=0x994f7a0, next=0x0) at sp-object.cpp:437 437 for ( ref = &parent->children ; *ref ; ref = &(*ref)->next ) { (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x080ce351 in sp_document_get_type () at document.cpp:74 74 { (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x08102195 in sp_object_attach_reref (parent=0x8527a48, object=0xcb15328, next=0x0) at sp-object.cpp:437 437 for ( ref = &parent->children ; *ref ; ref = &(*ref)->next ) { (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x40c7f9e8 in mallopt () from /lib/tls/libc.so.6 (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x08102195 in sp_object_attach_reref (parent=0x8527a48, object=0xe05cac8, next=0x0) at sp-object.cpp:437 437 for ( ref = &parent->children ; *ref ; ref = &(*ref)->next ) { (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x08102195 in sp_object_attach_reref (parent=0x8527a48, object=0xe8f2998, next=0x0) at sp-object.cpp:437 437 for ( ref = &parent->children ; *ref ; ref = &(*ref)->next ) { (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x08102195 in sp_object_attach_reref (parent=0x8527a48, object=0xf2f5528, next=0x0) at sp-object.cpp:437 437 for ( ref = &parent->children ; *ref ; ref = &(*ref)->next ) { (gdb) c Continuing.
Program received signal SIGINT, Interrupt. 0x08102195 in sp_object_attach_reref (parent=0x8527a48, object=0x10304690, next=0x0) at sp-object.cpp:437 437 for ( ref = &parent->children ; *ref ; ref = &(*ref)->next ) { (gdb) c Continuing.
So, most time seems to be spent in sp_object_attach_reref, SimpleNode::next(), SimpleNode::lastChild().