Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use dyn DatabaseExt everywhere #8924

Merged
merged 2 commits into from
Oct 3, 2024
Merged

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Sep 21, 2024

Closes #8404

* wip

* clean up

* fix

* clippy

* doc

* fix imports

* chore: simplify InspectorExt by making it lifetime-generic

* fmt

* chore: remove unnecessary casts and lifetimes

* chore: more unused lifetimes (clippy)

---------

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
@DaniPopes DaniPopes marked this pull request as ready for review October 2, 2024 23:48
@DaniPopes DaniPopes enabled auto-merge (squash) October 2, 2024 23:49
@klkvr
Copy link
Member

klkvr commented Oct 2, 2024

wondering if we could get a noticable perf degradation after this? given that Inspector::step will be dynamically dispatched now?

@DaniPopes DaniPopes merged commit 471e4ac into master Oct 3, 2024
21 checks passed
@DaniPopes DaniPopes deleted the dani/dyn-everywhere branch October 3, 2024 00:02
@DaniPopes
Copy link
Member Author

Looks like about 10% slower


Solady:

Benchmark 1: forge-main test
  Time (mean ± σ):      1.160 s ±  0.107 s    [User: 23.772 s, System: 0.174 s]
  Range (min … max):    1.012 s …  1.330 s    10 runs

Benchmark 2: forge-dyn test
  Time (mean ± σ):      1.246 s ±  0.094 s    [User: 25.132 s, System: 0.212 s]
  Range (min … max):    1.104 s …  1.396 s    10 runs

Summary
  forge-main test ran
    1.07 ± 0.13 times faster than forge-dyn test

Sablier v2 core:

Benchmark 1: forge-main test --nmc Fork
  Time (mean ± σ):      8.526 s ±  0.394 s    [User: 49.358 s, System: 0.754 s]
  Range (min … max):    7.992 s …  9.160 s    10 runs

Benchmark 2: forge-dyn test --nmc Fork
  Time (mean ± σ):      9.288 s ±  0.848 s    [User: 55.514 s, System: 0.697 s]
  Range (min … max):    8.306 s … 10.749 s    10 runs

Summary
  forge-main test --nmc Fork ran
    1.09 ± 0.11 times faster than forge-dyn test --nmc Fork

@klkvr
Copy link
Member

klkvr commented Oct 3, 2024

I think hottest paths are using &mut InspectorStack, so we could cheaply improve this by using I: InspectorExt?

at the cost of bloat from InspectorStack and dyn InspectorExt (from CheatcodesExecutor)

@DaniPopes
Copy link
Member Author

Yeah I'd be fine with that

@klkvr
Copy link
Member

klkvr commented Oct 3, 2024

implemented in #9011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

perf: use dyn Database to reduce churn and binary size
2 participants