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

Issue 210013002: Rely on 'memcpy' in WTF::copyChars (Closed)

Created:
6 years, 9 months ago by Mikhail
Modified:
6 years, 9 months ago
Reviewers:
abarth-chromium
CC:
blink-reviews, Mikhail, adamk+blink_chromium.org, Inactive, eseidel, Nico, tkent
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Rely on 'memcpy' in WTF::copyChars Before the change 'WTF::copyChars' contained an algorithm that was used instead of 'memcpy' if the number of characters had been less than 20. This however was unnecessary as 'memcpy' produces more efficient asm code than the home-brewed algorithm did as it uses 'movq' (instead of 'movl') doing the copying within the less number of asm commands (tested with GCC 4.6.3). So, this patch removes the home-brewed algorithm from 'WTF::copyChars' and makes it always rely on 'memcpy'. A simple testing programm doing the following code for (int i = 10000000; --i;) { // Re-create 'src' to prevent from optimizing cycle iterations out. char* src = new char[15]; copyChars(dest, src, 15); copyChars(dest, src, 14); delete[] src; } takes: 0m0.324s before the change 0m0.235s after the change (using 'memcpy'). Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=169865

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -22 lines) Patch
M Source/wtf/text/StringImpl.h View 2 chunks +1 line, -22 lines 3 comments Download

Messages

Total messages: 6 (0 generated)
Mikhail
PTAL
6 years, 9 months ago (2014-03-24 14:17:45 UTC) #1
abarth-chromium
lgtm https://codereview.chromium.org/210013002/diff/1/Source/wtf/text/StringImpl.h File Source/wtf/text/StringImpl.h (left): https://codereview.chromium.org/210013002/diff/1/Source/wtf/text/StringImpl.h#oldcode443 Source/wtf/text/StringImpl.h:443: // This number must be at least 2 ...
6 years, 9 months ago (2014-03-24 16:46:54 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mikhail.pozdnyakov@intel.com/210013002/1
6 years, 9 months ago (2014-03-24 16:47:03 UTC) #3
commit-bot: I haz the power
Change committed as 169865
6 years, 9 months ago (2014-03-24 17:27:56 UTC) #4
Mikhail
https://codereview.chromium.org/210013002/diff/1/Source/wtf/text/StringImpl.h File Source/wtf/text/StringImpl.h (right): https://codereview.chromium.org/210013002/diff/1/Source/wtf/text/StringImpl.h#newcode301 Source/wtf/text/StringImpl.h:301: } On 2014/03/24 16:46:54, abarth wrote: > Should we ...
6 years, 9 months ago (2014-03-25 10:30:25 UTC) #5
abarth-chromium
6 years, 9 months ago (2014-03-25 15:20:47 UTC) #6
Message was sent while issue was closed.
On 2014/03/25 10:30:25, mikhail.pozdnyakov wrote:
> This makes a bit better assembly, on the other hand I do not think we can ever
> feel it in the real world, so IMO branch can be removed indeed for the code
> simplification, wdyt?

I'd probably remove it.

Powered by Google App Engine
This is Rietveld 408576698