Closed
Bug 1473337
Opened 6 years ago
Closed 6 years ago
Omit ASCII-case length calculation for short strings when performing an encoding conversion that expands non-ASCII
Categories
(Core :: XPCOM, enhancement)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox63 | --- | fixed |
People
(Reporter: hsivonen, Assigned: hsivonen)
References
Details
Attachments
(1 file)
(Follow-up for bug 1402247.)
For conversions like UTF-16 to UTF-8, which expand the number of code units in the non-ASCII case, avoid trying to size the buffer for the ASCII case when:
1) the target string is an autostring and the worst case fits within the inline buffer.
2) when the target string is not an autostring but the input string is 64 or fewer code units in length.
Comment hidden (mozreview-request) |
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Assignee | ||
Updated•6 years ago
|
Attachment #8990253 -
Flags: review?(nika)
Comment 2•6 years ago
|
||
mozreview-review |
Comment on attachment 8990253 [details]
Bug 1473337 - Omit ASCII-case length calculation for short strings when performing an encoding conversion that expands non-ASCII.
https://reviewboard.mozilla.org/r/255290/#review264138
::: servo/support/gecko/nsstring/src/conversions.rs:124
(Diff revision 1)
> let mut handle = unsafe {
> self.bulk_write(old_len.checked_add(needed).ok_or(())?, old_len, false)?
> };
> let written = $convert(other, &mut handle.as_mut_slice()[old_len..]);
> - Ok(handle.finish(old_len + written, true))
> + let new_len = old_len + written;
> + Ok(handle.finish(new_len, new_len > 64))
is this "64" supposed to be the cache line? can we use a constant here?
::: servo/support/gecko/nsstring/src/conversions.rs:333
(Diff revision 1)
> + None
> + }
> + } else {
> + None
> + };
> + let (filled, num_ascii, mut handle) = if worst_case_needed.is_none() && long_string_stars_with_basic_latin(other) {
nit: long line
this might actually be clearer with uninitialized let statements above, and assignments into them rather than the tuple return values...
Attachment #8990253 -
Flags: review?(nika) → review+
Assignee | ||
Comment 3•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8990253 [details]
Bug 1473337 - Omit ASCII-case length calculation for short strings when performing an encoding conversion that expands non-ASCII.
https://reviewboard.mozilla.org/r/255290/#review264138
Thanks!
> is this "64" supposed to be the cache line? can we use a constant here?
Used constant.
> nit: long line
>
> this might actually be clearer with uninitialized let statements above, and assignments into them rather than the tuple return values...
Wrapped.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 6•6 years ago
|
||
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1e0dffecbfb0
Omit ASCII-case length calculation for short strings when performing an encoding conversion that expands non-ASCII. r=Nika
Comment 8•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Updated•4 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•