Skip to content

Commit

Permalink
Add benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
r-barnes committed May 23, 2022
1 parent 95a752f commit 05a661b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.prof
25 changes: 25 additions & 0 deletions benchmark/benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import cProfile
import pstats
from datetime import datetime

import pyDeltaRCM

delta = pyDeltaRCM.DeltaModel(save_eta_figs=False)

profiler = cProfile.Profile()
for i in range(10):
if i==3:
profiler.enable()

print(f"Iteration {i}")
delta.update()

profiler.disable()
profiler.print_stats()

my_date = datetime.now()
stats = pstats.Stats(profiler)
stats.dump_stats(f"bench_result_{my_date.isoformat()}.prof")
delta.finalize()

# Results can be plotted with, eg, `flameprof -o /z/out.svg bench_result_2022-05-23T10:39:22.808217.prof`

0 comments on commit 05a661b

Please sign in to comment.