Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Issue 149913004: Coalesce writes in SVGPathByteStreamBuilder (Closed)

Created:
6 years, 10 months ago by fs
Modified:
6 years, 10 months ago
CC:
blink-reviews, krit, ed+blinkwatch_opera.com, f(malita), gyuyoung.kim_webkit.org, pdr, Stephen Chennney, rwlbuis
Visibility:
Public.

Description

Coalesce writes in SVGPathByteStreamBuilder Add a helper class CoalescingBuffer, that collects the data for a segment into a local (stack) buffer, and then writes the entire stack buffer in one go to the SVGPathByteStream. This reduces codesize (on GCC 4.8) by roughly 50% (closePath being the only method that grows). Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=166523

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+81 lines, -57 lines) Patch
M Source/core/svg/SVGPathByteStreamBuilder.h View 1 chunk +0 lines, -19 lines 0 comments Download
M Source/core/svg/SVGPathByteStreamBuilder.cpp View 2 chunks +81 lines, -38 lines 1 comment Download

Messages

Total messages: 8 (0 generated)
fs
6 years, 10 months ago (2014-02-05 15:16:15 UTC) #1
fs
Crazy stuff(?). PTAL. (Some quick perf runs shows that this also speeds things up by ...
6 years, 10 months ago (2014-02-05 16:43:00 UTC) #2
Stephen Chennney
Actually, really good idea. LGTM.
6 years, 10 months ago (2014-02-05 16:46:16 UTC) #3
fs
The CQ bit was checked by fs@opera.com
6 years, 10 months ago (2014-02-05 17:20:34 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/fs@opera.com/149913004/1
6 years, 10 months ago (2014-02-05 17:21:07 UTC) #5
commit-bot: I haz the power
Change committed as 166523
6 years, 10 months ago (2014-02-05 18:15:45 UTC) #6
Chris Evans
https://codereview.chromium.org/149913004/diff/1/Source/core/svg/SVGPathByteStreamBuilder.cpp File Source/core/svg/SVGPathByteStreamBuilder.cpp (right): https://codereview.chromium.org/149913004/diff/1/Source/core/svg/SVGPathByteStreamBuilder.cpp#newcode41 Source/core/svg/SVGPathByteStreamBuilder.cpp:41: m_byteStream->append(m_bytes[i]); Drive-by: I was looking at this recently and ...
6 years, 10 months ago (2014-02-05 18:54:48 UTC) #7
fs
6 years, 10 months ago (2014-02-06 08:12:29 UTC) #8
Message was sent while issue was closed.
On 2014/02/05 18:54:48, Chris Evans wrote:
>
https://codereview.chromium.org/149913004/diff/1/Source/core/svg/SVGPathByteS...
> File Source/core/svg/SVGPathByteStreamBuilder.cpp (right):
> 
>
https://codereview.chromium.org/149913004/diff/1/Source/core/svg/SVGPathByteS...
> Source/core/svg/SVGPathByteStreamBuilder.cpp:41:
> m_byteStream->append(m_bytes[i]);
> Drive-by: I was looking at this recently and noticed another optimization we
> could do.
> 
> We could call Vector::ensureCapacity(m_currentOffset) and then do a raw
memcpy()
> to Vector::end().

Yepp, that would be nice, but the Vector interface would need some extensions to
achieve a sequence like:

v.reserveCapacity(v.size() + totalByteCount);
memcpy(v.end(), bytes, itemByteCount);
...more memcpys...
v.setSize(v.size() + totalByteCount); <<-- "Missing" AFAICS

Unless one wants to jinx the size of course...

> This will eliminate a vector length check per-append.

Using the append(const T*, size_t) version does eliminate the per-byte
length-check too, but there was no noticeable improvement in doing so (in my
measurements).

Powered by Google App Engine
This is Rietveld 408576698