Skip to content

feat: dispatch events #916

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

Draft
wants to merge 3 commits into
base: 2.6.x
Choose a base branch
from

Conversation

nikophil
Copy link
Member

@nikophil nikophil commented May 25, 2025

I'm still planning to make this work 😅 (I recently had the need for some global event system in Foundry)

this PR only contains the "global event system", just want to see if this PR was adding overhead 🤔

@nikophil
Copy link
Member Author

nikophil commented May 25, 2025

ok then, dispatching the events is actually the culprit

| benchmark                      | subject           | set | revs | its | mem_peak         | mode              | rstdev         |
+--------------------------------+-------------------+-----+------+-----+------------------+-------------------+----------------+
| CategoryFactoryBench           | bench_create      |     | 10   | 5   | 17.941mb +3.36%  | 6.961ms +42.50%   | ±3.15% -46.07% |
| CategoryFactoryBench           | bench_create_many | 1   | 10   | 5   | 17.953mb +3.35%  | 7.537ms +36.44%   | ±4.48% -16.12% |
| CategoryFactoryBench           | bench_create_many | 10  | 10   | 5   | 21.384mb +24.87% | 52.092ms +35.94%  | ±2.06% +80.35% |
| CategoryFactoryBench           | bench_create_many | 50  | 10   | 5   | 36.153mb +73.85% | 243.340ms +35.30% | ±1.75% +96.80% |
| ContactFactoryBench            | bench_create      |     | 10   | 5   | 17.723mb +0.85%  | 3.178ms -4.61%    | ±2.42% -15.81% |
| ContactFactoryBench            | bench_create_many | 1   | 10   | 5   | 17.727mb +0.91%  | 3.185ms +13.37%   | ±6.07% -12.84% |
| ContactFactoryBench            | bench_create_many | 10  | 10   | 5   | 18.606mb +7.91%  | 14.116ms +20.28%  | ±4.41% +96.76% |
| ContactFactoryBench            | bench_create_many | 50  | 10   | 5   | 22.726mb +31.28% | 60.565ms +23.66%  | ±0.58% -36.64% |
| PersistentDocumentFactoryBench | bench_create      |     | 10   | 5   | 16.236mb +0.47%  | 836.236μs +10.56% | ±0.97% -17.80% |
| PersistentDocumentFactoryBench | bench_create_many | 1   | 10   | 5   | 16.241mb +0.47%  | 895.347μs +15.70% | ±0.71% -8.13%  |
| PersistentDocumentFactoryBench | bench_create_many | 10  | 10   | 5   | 16.306mb +3.79%  | 5.586ms +13.52%   | ±1.29% -2.29%  |
| PersistentDocumentFactoryBench | bench_create_many | 50  | 10   | 5   | 17.939mb +13.91% | 26.747ms +15.04%  | ±0.72% -31.87% |
+--------------------------------+-------------------+-----+------+-----+------------------+-------------------+----------------+

with debug disabled:

+--------------------------------+-------------------+-----+------+-----+------------------+-------------------+----------------+
| benchmark                      | subject           | set | revs | its | mem_peak         | mode              | rstdev         |
+--------------------------------+-------------------+-----+------+-----+------------------+-------------------+----------------+
| CategoryFactoryBench           | bench_create      |     | 10   | 5   | 17.947mb -10.99% | 5.420ms +13.91%   | ±2.50% -15.17% |
| CategoryFactoryBench           | bench_create_many | 1   | 10   | 5   | 17.961mb -11.01% | 5.520ms +11.87%   | ±2.11% +60.09% |
| CategoryFactoryBench           | bench_create_many | 10  | 10   | 5   | 21.392mb -15.79% | 43.548ms +13.69%  | ±0.33% +8.49%  |
| CategoryFactoryBench           | bench_create_many | 50  | 10   | 5   | 36.161mb -26.00% | 216.228ms +17.27% | ±0.69% -45.41% |
| ContactFactoryBench            | bench_create      |     | 10   | 5   | 17.731mb -10.17% | 2.207ms +9.48%    | ±3.37% -20.87% |
| ContactFactoryBench            | bench_create_many | 1   | 10   | 5   | 17.734mb -10.17% | 2.280ms +9.94%    | ±2.59% -63.66% |
| ContactFactoryBench            | bench_create_many | 10  | 10   | 5   | 18.614mb -12.23% | 11.936ms +11.46%  | ±0.45% -66.47% |
| ContactFactoryBench            | bench_create_many | 50  | 10   | 5   | 22.734mb -17.90% | 54.064ms +13.44%  | ±0.55% -48.57% |
| PersistentDocumentFactoryBench | bench_create      |     | 10   | 5   | 16.244mb -14.02% | 767.641μs +2.56%  | ±1.72% +8.93%  |
| PersistentDocumentFactoryBench | bench_create_many | 1   | 10   | 5   | 16.248mb -14.01% | 793.903μs +0.02%  | ±2.61% +15.25% |
| PersistentDocumentFactoryBench | bench_create_many | 10  | 10   | 5   | 16.379mb -14.66% | 4.959ms +0.40%    | ±3.46% +59.38% |
| PersistentDocumentFactoryBench | bench_create_many | 50  | 10   | 5   | 18.013mb -20.50% | 23.596ms +2.66%   | ±1.35% -22.47% |
+--------------------------------+-------------------+-----+------+-----+------------------+-------------------+----------------+```

@nikophil nikophil force-pushed the feat/re-enable-global-events branch from 6419775 to 433db1d Compare May 25, 2025 19:52
@nikophil nikophil force-pushed the feat/re-enable-global-events branch from 433db1d to b42f9a7 Compare May 25, 2025 20:03
@nikophil nikophil force-pushed the feat/re-enable-global-events branch from 2a460d6 to 4026ec6 Compare May 26, 2025 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant