formations/python/python3/en/_build/html/duration.html

107 lines
4.6 KiB
HTML
Raw Normal View History

2018-08-21 10:25:44 +02:00
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>duration &#8212; pyfundoc documentation</title>
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: ' ',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</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/bizstyle.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="function" href="functype.html" />
<link rel="prev" title="Dict types" href="dicttype.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="functype.html" title="function"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="dicttype.html" title="Dict types"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyfundoc documentation</a> &#187;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="body" role="main">
<div class="section" id="duration">
<h1>duration<a class="headerlink" href="#duration" title="Permalink to this headline"></a></h1>
<p>The “timeit” module lets you measure the execution
time of small bits of Python code</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">timeit</span>
<span class="n">timeit</span><span class="o">.</span><span class="n">timeit</span><span class="p">(</span><span class="s1">&#39;&quot;-&quot;.join(str(n) for n in range(100))&#39;</span><span class="p">,</span>
<span class="n">number</span><span class="o">=</span><span class="mi">10000</span><span class="p">)</span>
<span class="c1"># 0.3412662749997253</span>
<span class="n">timeit</span><span class="o">.</span><span class="n">timeit</span><span class="p">(</span><span class="s1">&#39;&quot;-&quot;.join([str(n) for n in range(100)])&#39;</span><span class="p">,</span>
<span class="n">number</span><span class="o">=</span><span class="mi">10000</span><span class="p">)</span>
<span class="c1"># 0.2996307989997149</span>
<span class="n">timeit</span><span class="o">.</span><span class="n">timeit</span><span class="p">(</span><span class="s1">&#39;&quot;-&quot;.join(map(str, range(100)))&#39;</span><span class="p">,</span>
<span class="n">number</span><span class="o">=</span><span class="mi">10000</span><span class="p">)</span>
<span class="c1"># 0.24581470699922647</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="functype.html" title="function"
>next</a> |</li>
<li class="right" >
<a href="dicttype.html" title="Dict types"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyfundoc documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
</div>
</body>
</html>