[cfe-commits] r108375 - in /cfe/trunk: include/clang/Basic/FileManager.h include/clang/Rewrite/Rewriter.h lib/Basic/FileManager.cpp lib/Checker/LLVMConventionsChecker.cpp lib/Frontend/PCHReader.cpp lib/Rewrite/Rewriter.cpp
Chris Lattner
clattner at apple.com
Thu Jul 15 09:34:15 PDT 2010
On Jul 15, 2010, at 9:27 AM, Fariborz Jahanian wrote:
>
> On Jul 14, 2010, at 4:19 PM, Benjamin Kramer wrote:
>
>> Author: d0k
>> Date: Wed Jul 14 18:19:41 2010
>> New Revision: 108375
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=108375&view=rev
>> Log:
>> Pass StringRefs by value.
>
> I don't seem to see the rational for changing const llvm::StringRef &
> to StringRefs by value.
It's a (very small) performance win. StringRef is a pair (pointer +length). Passing it by value (e.g. on x86-64) causes it to be passed in two registers. Passing it by reference passes the address, requiring the callee to dereference it and pinning it to the stack in the caller.
-Chris
More information about the cfe-commits
mailing list