Closed Bug 481335 Opened 15 years ago Closed 15 years ago

[FIX]Consider caching the nsIURI for the href in anchors

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

It would be nice if GetHrefURIForAnchors() could use a cached value.  We could clear it at the same time as we clear the link state...

This does mean a bit more memory usage, of course.  Thoughts?
Keywords: perf
I think the extra memory would be fine. Aren't we keeping a hash of uri->link in the document anyway?
Oh, hmm.  Indeed.  So this would just be something like a single word.

I'll do this tomorrow.
Low hanging fruit, the very model of.

/be
Flags: wanted1.9.1?
Not sure about that; there is a user-visible behavior change here in some cases due to our existing poor handling of base changes, so I'm loath to take on branch at this point.
Assignee: nobody → bzbarsky
Summary: Consider caching the nsIURI for the href in anchors → [FIX]Consider caching the nsIURI for the href in anchors
Attached patch Like so, say (obsolete) — Splinter Review
Attachment #365452 - Flags: superreview?(jst)
Attachment #365452 - Flags: review?(jst)
Jonas, feel free to steal the review if you want, since a bunch of the patch is in nsAttrValue.
Oh, and the eFloatValue changes are just things that should have been added when that value type was added...
Comment on attachment 365452 [details] [diff] [review]
Like so, say

Looks good. Would be nice with tests though. Specifically test that moving nodes around in a tree where there are xml:base works. Where works means that .href resolves to the correct thing twice. And that links get colored appropriately when a page is loaded (you can generate unique urls)
Attachment #365452 - Flags: superreview?(jst)
Attachment #365452 - Flags: superreview+
Attachment #365452 - Flags: review?(jst)
Attachment #365452 - Flags: review+
I can pretty easily write tests for the xml:base thing that don't work, either with or without this patch (in terms of link coloring).  All it takes is xml:base in disconnected subtrees.

I'll write some basic tests, though.
OK, I did write a test, and it in fact caught bug 482394.  I'll check in with some todo()s and fix in that bug.
Attached patch With testSplinter Review
Attachment #365452 - Attachment is obsolete: true
Pushed http://hg.mozilla.org/mozilla-central/rev/dfee73c1165d
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Component: Content → DOM
QA Contact: content → general
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: