On this page
  1. time.perf_counter_ns
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

time.perf_counter_ns

Prev: time.perf_counter | Up: time | Next: time.process_time
Rel: time.asctime, time.clock_getres, time.clock_gettime, time.clock_gettime_ns
Ref: docs.python.org — time.perf_counter_ns
Tags: #public #python3 #stdlib #time


Import

import time
from time import perf_counter_ns

Signature & Overview

time.perf_counter_ns()

Performance counter for benchmarking as nanoseconds.

Usage

import time

t0 = time.perf_counter_ns()
_ = sum(range(100))
assert time.perf_counter_ns() >= t0

Gotchas

REPL Inspect

from time import perf_counter_ns
help(perf_counter_ns)

Linked from

Related notes