Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5832)

Issue 949044: StringByteBufferEncoder: Encode strings to a ByteBuffer (optimization)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by Evan Jones
Modified:
13 years, 10 months ago
Reviewers:
kenton
Base URL:
http://protobuf.googlecode.com/svn/trunk/java/
Visibility:
Public.

Description

This makes ProtoBench approximately 10% faster for both Speed and Size options. Unfortunately, this is a "risky" change, since it touches a lot of code. But in my tests it does make things go quite a bit faster. This version no longer affects the Lite runtime.

Patch Set 1 #

Patch Set 2 : Updated patch to not modify the lite runtime. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+437 lines, -17 lines) Patch
A java/src/main/java/com/google/protobuf/FastStringEncoder.java View 1 chunk +119 lines, -0 lines 0 comments Download
M java/src/main/java/com/google/protobuf/FieldSet.java View 2 chunks +4 lines, -2 lines 0 comments Download
A java/src/main/java/com/google/protobuf/StringByteBufferEncoder.java View 1 chunk +134 lines, -0 lines 0 comments Download
A java/src/test/java/com/google/protobuf/FastStringEncoderTest.java View 1 chunk +49 lines, -0 lines 0 comments Download
A java/src/test/java/com/google/protobuf/StringByteBufferEncoderTest.java View 1 chunk +88 lines, -0 lines 0 comments Download
M src/google/protobuf/compiler/java/java_helpers.h View 1 chunk +4 lines, -0 lines 0 comments Download
M src/google/protobuf/compiler/java/java_primitive_field.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/google/protobuf/compiler/java/java_primitive_field.cc View 4 chunks +38 lines, -15 lines 0 comments Download

Messages

Total messages: 2
Evan Jones
I mentioned this in the protobuf mailing list. I'm unsure if this optimization makes sense, ...
14 years ago (2010-04-28 18:32:58 UTC) #1
Evan Jones
13 years, 10 months ago (2010-06-06 15:17:13 UTC) #2
I've revised this patch to no longer affect the lite runtime. It might be worth
considering including this version. My tests show that this is 5-20% faster on
ProtoBench, for both Size and Speed messages. The downside is that this is a
fairly "invasive" change, and while I've attempted to test it carefully, it
still could introduce bugs.

But it is quite a bit faster.

Again: I won't be disappointed if it is decided that this is not appropriate to
be included in the main protocol buffer distribution. But I'll try to maintain
this patch anyway.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b