<Alexander G. Riccio> via llvm-dev
2016-Feb-03 17:58 UTC
[llvm-dev] llvm::Record::isSubClassOf(StringRef Name) constructs a new std::string
llvm::Record::isSubClassOf(StringRef Name) looks like this: bool isSubClassOf(StringRef Name) const { for (const auto &SCPair : SuperClasses) { if (SCPair.first->getNameInitAsString() == Name) return true; } return false; } Where getNameInitAsString copy constructs a new std::string. We're only using that temporary in a comparison. Is there a better way? This function is called quite frequently, so it becomes costly. Sincerely, Alexander Riccio -- "Change the world or go home." about.me/ariccio <http://about.me/ariccio> If left to my own devices, I will build more. ⁂ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160203/d32586c6/attachment.html>