Closed Bug 1431449 Opened 6 years ago Closed 6 years ago

Some URLParams values are created only to be thrown away afterwards

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

59 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: nox, Assigned: nox)

References

Details

Attachments

(5 files)

In many call sites, URLParams values are created only to call URLParams::ParseInput and traverse the result with URLParams::ForEach afterwards. This could be avoided by invoking the URLParams::ForEachIterator callback directly when parsing.
Comment on attachment 8943679 [details]
Bug 1431449 - Kill URLSearchParams::ForEach;

https://reviewboard.mozilla.org/r/214036/#review219824
Attachment #8943679 - Flags: review?(bzbarsky) → review+
Comment on attachment 8943680 [details]
Bug 1431449 - Introduce URLParams::Parse;

https://reviewboard.mozilla.org/r/214038/#review219828
Attachment #8943680 - Flags: review?(bzbarsky) → review+
Comment on attachment 8943681 [details]
Bug 1431449 - Make URLParams::DecodeString static;

https://reviewboard.mozilla.org/r/214040/#review219850
Attachment #8943681 - Flags: review?(bzbarsky) → review+
Comment on attachment 8943682 [details]
Bug 1431449 - Move nsTString::ToInteger* methods to nsTSubstring;

https://reviewboard.mozilla.org/r/214042/#review219852
Attachment #8943682 - Flags: review?(bzbarsky) → review+
Comment on attachment 8943683 [details]
Bug 1431449 - Make URLParams::ParseInput call URLParams::Parse instead of the opposite;

https://reviewboard.mozilla.org/r/214044/#review219856

r=me, though maybe it would be OK to leave the ForEach; might come in handy.

Also, we're basically replacing object construction with more virtual calls in the Parse/ParseInput case.  That's probably a win just due to less allocation, but it's not obvious....  Might be worth having the commit message explain why this is better, since the bug doesn't really.
Attachment #8943683 - Flags: review?(bzbarsky) → review+
I'm not sure what introduces more virtual calls, could you explain?
In the cases that did ParseInput (not Parse), we now have a virtual call for each name/value pair, via aIterator.URLParamsIterator, that didn't use to be there, right?
Oh yes, you are absolutely right. I'll add a note in the commit message, given how fast I forgot about it.
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/3b802a492170
Kill URLSearchParams::ForEach; r=bz
https://hg.mozilla.org/integration/autoland/rev/ddb98ad66aa0
Introduce URLParams::Parse; r=bz
https://hg.mozilla.org/integration/autoland/rev/d86e47eb88db
Make URLParams::DecodeString static; r=bz
https://hg.mozilla.org/integration/autoland/rev/ecc091d9860d
Move nsTString::ToInteger* methods to nsTSubstring; r=bz
https://hg.mozilla.org/integration/autoland/rev/c1b5b46f8558
Make URLParams::ParseInput call URLParams::Parse instead of the opposite; r=bz
Priority: -- → P2
See Also: 1430796
See Also: → 1431924
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: