[cfe-commits] [patch] Qualifiers refactor
John McCall
rjmccall at apple.com
Mon Sep 28 15:52:39 PDT 2009
John McCall wrote:
> The idea about adding a non-trivial branch to the old version is a good
> one; I'll let you know when I have numbers.
>
I made a fresh checkout of LLVM/clang 82704 and ran the standard benchmark
twice (n=40), once after applying the following patch:
--- include/clang/AST/Type.h (revision 82704)
+++ include/clang/AST/Type.h (working copy)
@@ -109,7 +109,7 @@ public:
unsigned getCVRQualifiers() const { return Value.getInt(); }
void setCVRQualifiers(unsigned Quals) { Value.setInt(Quals); }
- Type *getTypePtr() const { return Value.getPointer(); }
+ Type *getTypePtr() const { return Value.getPointer() == (Type *) 0xd0
? 0 : Value.getPointer(); }
void *getAsOpaquePtr() const { return Value.getOpaqueValue(); }
static QualType getFromOpaquePtr(void *Ptr) {
This is (very roughly) parallel to the change in getTypePtr() that the
QualType
refactor introduced; it's probably slightly more work, but it captures
the general
idea.
No branch in getTypePtr() (pristine 82704):
name avg min med max SD total
user 0.2120 0.2117 0.2120 0.2126 0.0002 8.4810
sys 0.0316 0.0306 0.0319 0.0308 0.0016 1.2658
wall 0.2478 0.2464 0.2475 0.2482 0.0008 9.9118
With branch in getTypePtr():
user 0.2228 0.2226 0.2228 0.2231 0.0001 8.9120
sys 0.0317 0.0311 0.0306 0.0300 0.0017 1.2690
wall 0.2593 0.2593 0.2588 0.2586 0.0021 10.3739
So the branch causes a 5% regression in average userland time.
John.
More information about the cfe-commits
mailing list