Bulia wrote:
Just tried CVS with your fix, it does improve the load time but not by much (was 1:50, now 1:39).
Yeah, in retrospect I'm not surprised. sp_object_attach_reref seems to have been dominating anyway (which also means that the virtual method call overhead really is negligible -- sp_object_attach_reref still uses direct member access).
Granted, I'm not certain how much speeding up sp_object_attach_reref will buy us, but it really is stupidly inefficient now and needs to be fixed.
In general the SPObject stuff is pretty bad, which is partly my fault and partly Lauris'. I'm not sure what either of us were thinking.
For example: SPObject *sp_object_get_child_by_repr(SPObject *object, SPRepr *repr) { g_return_val_if_fail(object != NULL, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(repr != NULL, NULL);
for ( SPObject *child = object->children ; child ; child = child->next ) { if ( SP_OBJECT_REPR(child) == repr ) { return child; } }
return NULL; }
(which is O(n))
Could trivially be rewritten as:
SPObject *sp_object_get_child_by_repr(SPObject *object, SPRepr *repr) { g_return_val_if_fail(object != NULL, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(repr != NULL, NULL);
SPObject *child = SP_OBJECT_DOCUMENT(object)->getObjectByRepr(repr); if ( child && SP_OBJECT_PARENT(child) == this ) { return child; } else { return NULL; } }
(which is O(1), at least, assuming a perfect hash function, but even without that never worse than O(n) and usually extremely better)
I will need to re-verify that this is never used to find clones, for which the second version wouldn't work, but I don't think it is.
On Fri, 2005-01-28 at 07:08, gavinband@...663... wrote:
I just upgraded to boehm-gc 6.4 - and now the file loads in about 35s.
Cool, I've been looking for confirmation that 6.4 fixes this particular GC bug! ^_^
Moreover, I can see the whole file unlike in the other programs I've tried.
Hmm, I wonder why that is. Our internals are not _that_ different from Sodipodi yet, except the renderer. But I'm glad to hear it. ^_^
-mental