<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The ObjectCache eliminates the need to recompile the function, but the resultant object file must still be processed by the RuntimeDyld (dynamic loader).  This
 processing consists of applying relocations to the function, and that’s where all of the DenseMap references are coming from.  It may be that there is an opportunity here to optimize the current code.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">For a single function, I’m not surprised that using the ObjectCache doesn’t save a significant amount of time.  The ObjectCache is generally more useful when
 you have a large block of library type functions that you know ahead of time aren’t likely to change but which need to be compiled at runtime at least once.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
<b>On Behalf Of </b>Cheng Zhu<br>
<b>Sent:</b> Thursday, September 25, 2014 6:29 PM<br>
<b>To:</b> LLVM Developers Mailing List<br>
<b>Subject:</b> [LLVMdev] not much performance gain when reuse the JIT cached compiled object in the subsequent call to the same function ....<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi, All<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I am using MCJIT to compile a expression function and save the JIT compiled object into a ObjectCache using std::map<std::string functionName, llvm::MemoryBuffer> and then it could be reused in the subsequent call to that expression function.
 However I don't get much performance gain vs. still compile the same function in each call and not to save the compiled object into ObjectCache. One interesting observation in the perf top is that there are many usage on functions under llvm::DenseMapBase.
 libptcompiler.so is the library contains a llvm helper class and it has the ObjectCache in it. Does the usage make sense to you guys and any suggestion? Thank you.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
 1.72%  libptcompiler.so                    [.] bool llvm::DenseMapBase<llvm::DenseMap<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >, void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >::LookupBucketFor<void const<br>
  1.45%  libptcompiler.so                    [.] llvm::sys::MemoryFence()<br>
  1.20%  libptcompiler.so                    [.] llvm::DenseMapInfo<void const*>::isEqual(void const*, void const*)<br>
  1.02%  libptcompiler.so                    [.] bool llvm::DenseMapBase<llvm::DenseMap<void const*, llvm::PassInfo const*, llvm::DenseMapInfo<void const*> >, void const*, llvm::PassInfo const*, llvm::DenseMapInfo<void const*> >::Lookup<br>
  0.95%  libptcompiler.so                    [.] llvm::DenseMapInfo<unsigned int>::isEqual(unsigned int const&, unsigned int const&)<br>
  0.94%  libptcompiler.so                    [.] llvm::DenseMap<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >::getBuckets() const<br>
  0.93%  libptcompiler.so                    [.] llvm::PMTopLevelManager::findAnalysisPass(void const*)<br>
  0.81%  libptcompiler.so                    [.] llvm::DenseMapIterator<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*>, true>::DenseMapIterator(llvm::DenseMapIterator<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*>,<br>
  0.76%  libptcompiler.so                    [.] llvm::DenseMap<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >::getNumBuckets() const<br>
  0.75%  libptcompiler.so                    [.] llvm::DenseMapBase<llvm::DenseMap<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >, void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >::getBucketsEnd()<br>
  0.73%  libptcompiler.so                    [.] llvm::DenseMapIterator<llvm::Pass*, llvm::Pass*, llvm::DenseMapInfo<llvm::Pass*>, false>::AdvancePastEmptyBuckets()<br>
  0.72%  libptcompiler.so                    [.] bool llvm::DenseMapBase<llvm::DenseMap<unsigned int, std::pair<unsigned int, unsigned int>, llvm::DenseMapInfo<unsigned int> >, unsigned int, std::pair<unsigned int, unsigned int>, llvm::<br>
  0.69%  <a href="http://libpthread-2.12.so">libpthread-2.12.so</a>                  [.] pthread_rwlock_rdlock<br>
  0.65%  <a href="http://libc-2.12.so">libc-2.12.so</a>                        [.] _int_malloc<br>
  0.61%  <a href="http://libpthread-2.12.so">libpthread-2.12.so</a>                  [.] pthread_rwlock_unlock<br>
  0.61%  perf                                [.] 0x000000000005f1dd<br>
  0.60%  libptcompiler.so                    [.] llvm::DenseMapInfo<llvm::Pass*>::isEqual(llvm::Pass const*, llvm::Pass const*)<br>
  0.57%  libptcompiler.so                    [.] llvm::DenseMapIterator<void const*, llvm::PassInfo const*, llvm::DenseMapInfo<void const*>, true>::DenseMapIterator(llvm::DenseMapIterator<void const*, llvm::PassInfo const*, llvm::DenseM<br>
  0.55%  libptcompiler.so                    [.] llvm::DenseMapBase<llvm::DenseMap<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >, void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >::getBuckets()<br>
  0.50%  <a href="http://libc-2.12.so">libc-2.12.so</a>                        [.] malloc<br>
  0.50%  libptcompiler.so                    [.] llvm::DenseMapBase<llvm::DenseMap<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >, void const*, llvm::Pass*, llvm::DenseMapInfo<void const*> >::getNumBuckets() const<br>
  0.49%  libptcompiler.so                    [.] llvm::DenseMapIterator<void const*, llvm::Pass*, llvm::DenseMapInfo<void const*>, false>::DenseMapIterator(std::pair<void const*, llvm::Pass*>*, std::pair<void const*, llvm::Pass*>*, bool<br>
Press '?' for help on key bindings<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <br>
Best regards<br>
<br>
Cheng <o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>