kidok / protobuf

Automatically exported from code.google.com/p/protobuf
0 stars 0 forks source link

Speed up readRawVarint32 by >30% #534

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Attached is a patch that applies on top of r497 and a Caliper benchmark.  The 
Caliper benchmark is showing a consistent >30% improvement.  This is really a 
micro-optimization but because this is in the fast path of almost everything, I 
thought you'd consider including it upstream.

Environment: OS X 10.8.3, Java 1.6.0_45, Intel i7-3615QM @ 2.30GHz
 0% Scenario{vm=java, trial=0, benchmark=Tsuna} 6.69 ns; σ=0.07 ns @ 4 trials
50% Scenario{vm=java, trial=0, benchmark=Google} 10.60 ns; σ=0.09 ns @ 3 trials

benchmark    ns linear runtime
    Tsuna  6.68 ==================
   Google 10.60 ==============================

=> 37% faster

Environment: Linux 3.4.24, Java 1.6.0_20, Dual Intel E5-2620 @ 2.00GHz
 0% Scenario{vm=java, trial=0, benchmark=Tsuna} 8.94 ns; σ=0.03 ns @ 3 trials
50% Scenario{vm=java, trial=0, benchmark=Google} 13.32 ns; σ=0.06 ns @ 3 trials

benchmark    ns linear runtime
    Tsuna  8.94 ====================
   Google 13.38 ==============================

=> 33% faster

Original issue reported on code.google.com by tsuna...@gmail.com on 21 Jul 2013 at 9:35

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by xiaof...@google.com on 22 Jul 2013 at 6:00