<div><h2id="profile"><ahref="#profile"name="profile">#</a>Profile</h2><div><h3id="basic">Basic</h3><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> time <spanclass="hljs-keyword">import</span> time
<div><h2id="profiling"><ahref="#profiling"name="profiling">#</a>Profiling</h2><div><h3id="stopwatch">Stopwatch</h3><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> time <spanclass="hljs-keyword">import</span> time
start_time = time() <spanclass="hljs-comment"># Seconds since the Epoch.</span>
...
duration = time() - start_time
</code></pre></div></div>
<div><h3id="highperformance">High Performance</h3><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> time <spanclass="hljs-keyword">import</span> perf_counter
<div><h4id="highperformance">High performance:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> time <spanclass="hljs-keyword">import</span> perf_counter
start_time = perf_counter() <spanclass="hljs-comment"># Seconds since restart.</span>
<div><h3id="callgraph">Call Graph</h3><div><h4id="generatesapngimageofacallgraphwithhighlightedbottlenecks">Generates a PNG image of a call graph with highlighted bottlenecks:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-comment"># $ pip3 install pycallgraph</span>
<div><h3id="timingbyfunction">Timing by Function</h3><div><h4id="generatesapngimageofacallgraphwithhighlightedbottlenecks">Generates a PNG image of a call graph with highlighted bottlenecks:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-comment"># $ pip3 install pycallgraph</span>
<div><h2id="numpy"><ahref="#numpy"name="numpy">#</a>NumPy</h2><p><strong>Array manipulation mini language. Can run up to one hundred times faster than equivalent Python code.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-comment"># $ pip3 install numpy</span>