Merge lp://qastaging/~liampwhite/inkscape/spfactory-gperf into lp://qastaging/~inkscape.dev/inkscape/trunk

Proposed by Liam P. White
Status: Needs review
Proposed branch: lp://qastaging/~liampwhite/inkscape/spfactory-gperf
Merge into: lp://qastaging/~inkscape.dev/inkscape/trunk
Diff against target: 1080 lines (+826/-215)
2 files modified
src/sp-factory.cpp (+466/-215)
src/sp-factory.gperf (+360/-0)
To merge this branch: bzr merge lp://qastaging/~liampwhite/inkscape/spfactory-gperf
Reviewer Review Type Date Requested Status
Krzysztof Kosinski Needs Fixing
Review via email: mp+285286@code.qastaging.launchpad.net

Description of the change

Converts SPFactory's strcmp chain to a constant-time hash table lookup.

Should improve loading performance by small amounts in complex documents.

To post a comment you must log in.
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

I am skeptical about this.

1. Do we have any evidence that the strcmp chain is a performance problem?

2. At a minimum, this must be integrated with the build system, so that sp-factory.cpp is automatically rebuilt whenever sp-factory.gperf is modified.

3. I'd rather see something based on a trie initialized at runtime, since it would be more generally useful; for instance, we could reuse it for ID lookup.

review: Needs Fixing
Revision history for this message
Liam P. White (liampwhite) wrote :

1. No. strcmp is fast enough that most of the time you won't even notice the difference, especially for comparing small strings like these typenames.

2. That is the pain point of this merge proposal. IIRC win32 does not have gperf in its binaries. It might not be necessary but for pedanticism we would want to implement that (in both build systems, sigh.)

3. A trie has comparable or worse performance than a perfect hash table.

Revision history for this message
jazzynico (jazzynico) wrote :

2. Gperf was added in the win32 devlibs rev. 55.But it's still missing in de win64 devlibs.

Unmerged revisions

14636. By Liam P. White

convert SPFactory to a gperf table
undo some earlier stupidity

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.