Skip to content

Commit

Permalink
squash! Vector2: Use __slots__ to reserve space rather than use a dic…
Browse files Browse the repository at this point in the history
…tionary

Comparison with master as of caa4ef0:

  $ python3 -m perf compare_to benchmark_*.json --table
  +-----------+------------------+------------------------------+
  | Benchmark | benchmark_master | benchmark_slots              |
  +===========+==================+==============================+
  | __add__   | 4.83 us          | 2.49 us: 1.94x faster (-48%) |
  +-----------+------------------+------------------------------+
  | __eq__    | 914 ns           | 495 ns: 1.85x faster (-46%)  |
  +-----------+------------------+------------------------------+
  | convert   | 468 ns           | 326 ns: 1.44x faster (-30%)  |
  +-----------+------------------+------------------------------+
  | normalize | 9.45 us          | 5.81 us: 1.63x faster (-39%) |
  +-----------+------------------+------------------------------+
  | length    | 451 ns           | 662 ns: 1.47x slower (+47%)  |
  +-----------+------------------+------------------------------+
  | rotate    | 4.20 us          | 6.56 us: 1.56x slower (+56%) |
  +-----------+------------------+------------------------------+
  | scale_by  | 2.11 us          | 1.58 us: 1.33x faster (-25%) |
  +-----------+------------------+------------------------------+
  | scale_to  | 5.10 us          | 7.08 us: 1.39x slower (+39%) |
  +-----------+------------------+------------------------------+

  Not significant (7): __sub__; reflect; angle; dot; isclose; __neg__; truncate
  • Loading branch information
nbraud committed Mar 6, 2019
1 parent 10f882a commit 7da30b2
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 7da30b2

Please sign in to comment.