Browse Source

Perf counter

pull/42/head
Jure Šorn 5 years ago
parent
commit
bbaef7f3d4
2 changed files with 8 additions and 8 deletions
  1. 8
      README.md
  2. 8
      index.html

8
README.md

@ -2389,17 +2389,17 @@ Profile
### Basic ### Basic
```python ```python
from time import time from time import time
start_time = time() # Seconds since the Epoch.
start_time = time() # Seconds since the Epoch.
... ...
duration = time() - start_time duration = time() - start_time
``` ```
### High Performance ### High Performance
```python ```python
from time import perf_counter as pc
start_time = pc() # Seconds since restart.
from time import perf_counter
start_time = perf_counter() # Seconds since restart.
... ...
duration = pc() - start_time
duration = perf_counter() - start_time
``` ```
### Timing a Snippet ### Timing a Snippet

8
index.html

@ -2052,16 +2052,16 @@ run(host=<span class="hljs-string">'0.0.0.0'</span>, port=<span class="hljs-numb
</code></pre></div> </code></pre></div>
<div><h2 id="profile"><a href="#profile" name="profile">#</a>Profile</h2><div><h3 id="basic">Basic</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> time <div><h2 id="profile"><a href="#profile" name="profile">#</a>Profile</h2><div><h3 id="basic">Basic</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> time
start_time = time() <span class="hljs-comment"># Seconds since the Epoch.</span>
start_time = time() <span class="hljs-comment"># Seconds since the Epoch.</span>
... ...
duration = time() - start_time duration = time() - start_time
</code></pre></div></div> </code></pre></div></div>
<div><h3 id="highperformance">High Performance</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> perf_counter <span class="hljs-keyword">as</span> pc
start_time = pc() <span class="hljs-comment"># Seconds since restart.</span>
<div><h3 id="highperformance">High Performance</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> perf_counter
start_time = perf_counter() <span class="hljs-comment"># Seconds since restart.</span>
... ...
duration = pc() - start_time
duration = perf_counter() - start_time
</code></pre></div> </code></pre></div>
<div><h3 id="timingasnippet">Timing a Snippet</h3><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> timeit <span class="hljs-keyword">import</span> timeit <div><h3 id="timingasnippet">Timing a Snippet</h3><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> timeit <span class="hljs-keyword">import</span> timeit

Loading…
Cancel
Save