<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, May 26, 2017 at 8:57 AM Rui Ueyama via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ruiu added inline comments.<br>
<br>
<br>
================<br>
Comment at: include/llvm/Object/RelocVisitor.h:62<br>
+                                            uint64_t Value);<br>
+  Visitor Vis;<br>
+<br>
----------------<br>
grimar wrote:<br>
> ruiu wrote:<br>
> > Why don't you use std::function?<br>
> I am pretty sure I was asked by somebody to use poiner in one of reviews earlier, do not really remember why, so<br>
> I supposed it is preferred in LLVM before your comment, though it looks std::function is used widely. So I can switch to it.<br>
Well, maybe a bare pointer is smaller and faster than std::function, I guess? I'd guess David Blaikie knows more than me about that.<br></blockquote><div><br>A good std::function implementation will at least use inline storage for function pointers - but it may have some size and runtime overhead (might use a virtual function (or at least a conditional of some kind) to dispatch to a handler that then calls the function pointer - indeed that overhead may be less if you pass a lambda instead of a function pointer (so it's one indirection instead of two)).<br><br>I'm not too fussed/happy to use raw function pointers when it's sufficiently constrained such that it's not "API surface" where you want to support different callbacks with different needs, etc. But also don't mind std::function - but probably worth measuring the relative performance if the point of this is to improve perf.<br><br>- Dave<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<a href="https://reviews.llvm.org/D33548" rel="noreferrer" target="_blank">https://reviews.llvm.org/D33548</a><br>
<br>
<br>
<br>
</blockquote></div></div>