[Xorp-cvs] XORP cvs commit: xorp/policy xorp/policy/backend xorp/policy/common
Andrea Bittau
abittau at icir.org
Wed Aug 6 01:08:31 PDT 2008
CVSROOT: /usr/local/www/data/cvs
Module name: xorp
Changes by: abittau at chum.icir.org 2008-08-06 08:08:31 UTC
XORP CVS repository
Modified files:
policy visitor_semantic.cc
policy/backend iv_exec.cc
policy/common register_operations.cc
Log message:
Don't create temporary objects when executing. (Only for the AsPath prepend
case for now). The basic problem is as follows. Say you have an expression:
1 + 5 + 10
Before, I'd do 1 + 5 and create a new 6 object, and then 6 + 10, and create a 16
object. Now I do 1 + 5 and return the same 1 object but modified to 6. I.e., I
reuse one of the args to the expression. It's a bit like using an accumulator
argument when recursing I guess...
This makes the interface much nastier - hence why I hate optimizing =D.
Before:
[58% 02:14 shorty test]# ./policybench -p base -v base.var -i 100000
Loading...
Benchmarking. Iterations: 100000
Stats:
Total time 1006 (ms) iterations 100000
Iterations/s 99403.579
Instr 1 Avg Time 182.589 ( 2.05%)
Instr 2 Avg Time 653.278 ( 7.33%)
Instr 3 Avg Time 850.118 ( 9.54%)
Instr 4 Avg Time 311.957 ( 3.50%)
Instr 5 Avg Time 657.300 ( 7.38%)
Instr 6 Avg Time 222.927 ( 2.50%)
Instr 7 Avg Time 2735.710 (30.71%)
Instr 8 Avg Time 589.444 ( 6.62%)
Instr 9 Avg Time 222.574 ( 2.50%)
Instr 10 Avg Time 2481.870 (27.86%)
[58% 01:58 shorty test]#
Now:
[47% 02:08 shorty test]# ./policybench -p base -v base.var -i 100000
Loading...
Benchmarking. Iterations: 100000
Stats:
Total time 838 (ms) iterations 100000
Iterations/s 119331.742
Instr 1 Avg Time 184.390 ( 2.54%)
Instr 2 Avg Time 640.111 ( 8.83%)
Instr 3 Avg Time 769.805 (10.62%)
Instr 4 Avg Time 295.817 ( 4.08%)
Instr 5 Avg Time 701.665 ( 9.68%)
Instr 6 Avg Time 213.541 ( 2.95%)
Instr 7 Avg Time 1172.950 (16.18%)
Instr 8 Avg Time 609.467 ( 8.41%)
Instr 9 Avg Time 215.179 ( 2.97%)
Instr 10 Avg Time 2446.334 (33.75%)
[47% 01:40 shorty test]#
Look at Instr 7 - it's twice as fast. I think BGP ASPath prepend is almost as
optimized as it can get, at least for now. I'll move on. (Actually it seems
like if Ive merely moved the problem eslewhere - instr 10 ;D.)
Revision Changes Path
1.20 +16 -5; commitid: 830448995be841a7; xorp/policy/backend/iv_exec.cc
1.24 +5 -5; commitid: 830448995be841a7; xorp/policy/common/register_operations.cc
1.17 +11 -5; commitid: 830448995be841a7; xorp/policy/visitor_semantic.cc
More information about the Xorp-cvs
mailing list