This file is indexed.

/usr/share/doc/pybind11-doc/html/benchmark.html is in pybind11-doc 2.0.1-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Benchmark &mdash; pybind11 2.0.1 documentation</title>
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  
    <link rel="stylesheet" href="_static/theme_overrides.css" type="text/css" />
  

  
        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="pybind11 2.0.1 documentation" href="index.html"/>
        <link rel="next" title="Limitations" href="limitations.html"/>
        <link rel="prev" title="Frequently asked questions" href="faq.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> pybind11
          

          
          </a>

          
            
            
              <div class="version">
                2.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
                <ul>
<li class="toctree-l1"><a class="reference internal" href="intro.html">About this project</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
</ul>
<p class="caption"><span class="caption-text">The Basics</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="basics.html">First steps</a></li>
<li class="toctree-l1"><a class="reference internal" href="classes.html">Object-oriented code</a></li>
<li class="toctree-l1"><a class="reference internal" href="compiling.html">Build systems</a></li>
</ul>
<p class="caption"><span class="caption-text">Advanced Topics</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="advanced/functions.html">Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced/classes.html">Classes</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced/exceptions.html">Exceptions</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced/smart_ptrs.html">Smart pointers</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced/cast/index.html">Type conversions</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced/pycpp/index.html">Python C++ interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced/misc.html">Miscellaneous</a></li>
</ul>
<p class="caption"><span class="caption-text">Extra Information</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently asked questions</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Benchmark</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#setup">Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="#compilation-time">Compilation time</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-size">Module size</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="limitations.html">Limitations</a></li>
<li class="toctree-l1"><a class="reference internal" href="reference.html">Reference</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="index.html">pybind11</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          

 



<div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="index.html">Docs</a> &raquo;</li>
      
    <li>Benchmark</li>
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="_sources/benchmark.txt" rel="nofollow"> View page source</a>
          
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="benchmark">
<h1>Benchmark<a class="headerlink" href="#benchmark" title="Permalink to this headline"></a></h1>
<p>The following is the result of a synthetic benchmark comparing both compilation
time and module size of pybind11 against Boost.Python. A detailed report about a
Boost.Python to pybind11 conversion of a real project is available here: <a class="footnote-reference" href="#f1" id="id1">[1]</a>.</p>
<table class="docutils footnote" frame="void" id="f1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td><a class="reference external" href="http://graylab.jhu.edu/RosettaCon2016/PyRosetta-4.pdf">http://graylab.jhu.edu/RosettaCon2016/PyRosetta-4.pdf</a></td></tr>
</tbody>
</table>
<div class="section" id="setup">
<h2>Setup<a class="headerlink" href="#setup" title="Permalink to this headline"></a></h2>
<p>A python script (see the <code class="docutils literal"><span class="pre">docs/benchmark.py</span></code> file) was used to generate a set
of files with dummy classes whose count increases for each successive benchmark
(between 1 and 2048 classes in powers of two). Each class has four methods with
a randomly generated signature with a return value and four arguments. (There
was no particular reason for this setup other than the desire to generate many
unique function signatures whose count could be controlled in a simple way.)</p>
<p>Here is an example of the binding code for one class:</p>
<div class="highlight-cpp"><div class="highlight"><pre><span></span><span class="p">...</span>
<span class="k">class</span> <span class="nc">cl034</span> <span class="p">{</span>
<span class="k">public</span><span class="o">:</span>
    <span class="n">cl279</span> <span class="o">*</span><span class="n">fn_000</span><span class="p">(</span><span class="n">cl084</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl057</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl065</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl042</span> <span class="o">*</span><span class="p">);</span>
    <span class="n">cl025</span> <span class="o">*</span><span class="nf">fn_001</span><span class="p">(</span><span class="n">cl098</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl262</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl414</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl121</span> <span class="o">*</span><span class="p">);</span>
    <span class="n">cl085</span> <span class="o">*</span><span class="nf">fn_002</span><span class="p">(</span><span class="n">cl445</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl297</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl145</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl421</span> <span class="o">*</span><span class="p">);</span>
    <span class="n">cl470</span> <span class="o">*</span><span class="nf">fn_003</span><span class="p">(</span><span class="n">cl200</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl323</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl332</span> <span class="o">*</span><span class="p">,</span> <span class="n">cl492</span> <span class="o">*</span><span class="p">);</span>
<span class="p">};</span>
<span class="p">...</span>

<span class="n">PYBIND11_PLUGIN</span><span class="p">(</span><span class="n">example</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">py</span><span class="o">::</span><span class="n">module</span> <span class="n">m</span><span class="p">(</span><span class="s">&quot;example&quot;</span><span class="p">);</span>
    <span class="p">...</span>
    <span class="n">py</span><span class="o">::</span><span class="n">class_</span><span class="o">&lt;</span><span class="n">cl034</span><span class="o">&gt;</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="s">&quot;cl034&quot;</span><span class="p">)</span>
        <span class="p">.</span><span class="n">def</span><span class="p">(</span><span class="s">&quot;fn_000&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">cl034</span><span class="o">::</span><span class="n">fn_000</span><span class="p">)</span>
        <span class="p">.</span><span class="n">def</span><span class="p">(</span><span class="s">&quot;fn_001&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">cl034</span><span class="o">::</span><span class="n">fn_001</span><span class="p">)</span>
        <span class="p">.</span><span class="n">def</span><span class="p">(</span><span class="s">&quot;fn_002&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">cl034</span><span class="o">::</span><span class="n">fn_002</span><span class="p">)</span>
        <span class="p">.</span><span class="n">def</span><span class="p">(</span><span class="s">&quot;fn_003&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">cl034</span><span class="o">::</span><span class="n">fn_003</span><span class="p">)</span>
    <span class="p">...</span>
    <span class="k">return</span> <span class="n">m</span><span class="p">.</span><span class="n">ptr</span><span class="p">();</span>
<span class="p">}</span>
</pre></div>
</div>
<p>The Boost.Python version looks almost identical except that a return value
policy had to be specified as an argument to <code class="docutils literal"><span class="pre">def()</span></code>. For both libraries,
compilation was done with</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>Apple LLVM version <span class="m">7</span>.0.2 <span class="o">(</span>clang-700.1.81<span class="o">)</span>
</pre></div>
</div>
<p>and the following compilation flags</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>g++ -Os -shared -rdynamic -undefined dynamic_lookup -fvisibility<span class="o">=</span>hidden -std<span class="o">=</span>c++14
</pre></div>
</div>
</div>
<div class="section" id="compilation-time">
<h2>Compilation time<a class="headerlink" href="#compilation-time" title="Permalink to this headline"></a></h2>
<p>The following log-log plot shows how the compilation time grows for an
increasing number of class and function declarations. pybind11 includes many
fewer headers, which initially leads to shorter compilation times, but the
performance is ultimately fairly similar (pybind11 is 19.8 seconds faster for
the largest largest file with 2048 classes and a total of 8192 methods &#8211; a
modest <strong>1.2x</strong> speedup relative to Boost.Python, which required 116.35
seconds).</p>
<img alt="_images/pybind11_vs_boost_python1.svg" src="_images/pybind11_vs_boost_python1.svg" /></div>
<div class="section" id="module-size">
<h2>Module size<a class="headerlink" href="#module-size" title="Permalink to this headline"></a></h2>
<p>Differences between the two libraries become much more pronounced when
considering the file size of the generated Python plugin: for the largest file,
the binary generated by Boost.Python required 16.8 MiB, which was <strong>2.17
times</strong> / <strong>9.1 megabytes</strong> larger than the output generated by pybind11. For
very small inputs, Boost.Python has an edge in the plot below &#8211; however, note
that it stores many definitions in an external library, whose size was not
included here, hence the comparison is slightly shifted in Boost.Python&#8217;s
favor.</p>
<img alt="_images/pybind11_vs_boost_python2.svg" src="_images/pybind11_vs_boost_python2.svg" /></div>
</div>


           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="limitations.html" class="btn btn-neutral float-right" title="Limitations" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="faq.html" class="btn btn-neutral" title="Frequently asked questions" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2017, Wenzel Jakob.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'2.0.1',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>