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

Fix false positive circular dependencies #470

Merged
merged 6 commits into from
Mar 7, 2025

Conversation

notaphplover
Copy link
Member

@notaphplover notaphplover commented Mar 7, 2025

Changed

  • Updated plan to no longer detect false positive circular dependencies.

Context

Refer to inversify/InversifyJS#1744 for more information.

@notaphplover notaphplover self-assigned this Mar 7, 2025
@notaphplover notaphplover added the bug Something isn't working label Mar 7, 2025
Copy link
Contributor

github-actions bot commented Mar 7, 2025

Benchmarks results:

[CJS] Running benchmarks...

Get service in singleton scope
┌─────────┬────────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''301.59 ± 1.00%''280.00 ± 9.00''3526405 ± 0.01%''3571429 ± 118608'     │ 3315717 │
│ 1       │ 'inversify6''994.26 ± 2.10%''912.00 ± 11.00''1074939 ± 0.01%''1096491 ± 13387'      │ 1005778 │
│ 2       │ 'NestJS''295.09 ± 0.67%''280.00 ± 9.00''3571508 ± 0.01%''3571429 ± 118608'     │ 3389017 │
│ 3       │ 'tsyringe''313.00 ± 1.02%''291.00 ± 9.00''3384892 ± 0.01%''3436426 ± 103093'     │ 3194884 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 3.281x
inversifyCurrent vs NestJS Speedup: 0.987x
inversifyCurrent vs tsyringe Speedup: 1.042x

Get service in transient scope
┌─────────┬────────────────────┬──────────────────┬───────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns) │ Latency med (ns)  │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼──────────────────┼───────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''637.03 ± 0.52%''601.00 ± 10.00''1650565 ± 0.01%''1663894 ± 28154'      │ 1569777 │
│ 1       │ 'inversify6''5198.0 ± 2.49%''4859.0 ± 70.00''202047 ± 0.04%''205804 ± 3008'        │ 192381  │
│ 2       │ 'NestJS''8946.1 ± 1.22%''7844.0 ± 151.00''124136 ± 0.07%''127486 ± 2485'        │ 111781  │
│ 3       │ 'tsyringe''477.03 ± 0.42%''450.00 ± 9.00''2205577 ± 0.01%''2222222 ± 45351'      │ 2096292 │
└─────────┴────────────────────┴──────────────────┴───────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 8.169x
inversifyCurrent vs NestJS Speedup: 13.296x
inversifyCurrent vs tsyringe Speedup: 0.748x

Get complex service in singleton scope
┌─────────┬────────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''346.64 ± 3.46%''311.00 ± 9.00''3156782 ± 0.01%''3215434 ± 90434'      │ 2884806 │
│ 1       │ 'inversify6''1058.5 ± 3.09%''971.00 ± 19.00''1019275 ± 0.01%''1029866 ± 20554'      │ 944765  │
│ 2       │ 'NestJS''338.63 ± 0.81%''310.00 ± 9.00''3197296 ± 0.01%''3225806 ± 96453'      │ 2953051 │
│ 3       │ 'tsyringe''328.53 ± 2.85%''291.00 ± 9.00''3355082 ± 0.01%''3436426 ± 103093'     │ 3043890 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 3.097x
inversifyCurrent vs NestJS Speedup: 0.987x
inversifyCurrent vs tsyringe Speedup: 0.941x

Get complex service in transient scope
┌─────────┬────────────────────┬───────────────────┬───────────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns)  │ Latency med (ns)      │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼───────────────────┼───────────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''348058 ± 0.63%''338250 ± 4047.50''2903 ± 0.27%''2956 ± 35'            │ 2874    │
│ 1       │ 'inversify6''4989622 ± 0.96%''4936433 ± 282787.00''201 ± 0.91%''203 ± 12'             │ 201     │
│ 2       │ 'NestJS''59007 ± 1.10%''53900 ± 691.00''18096 ± 0.16%''18553 ± 237'          │ 16948   │
│ 3       │ 'tsyringe''262635 ± 0.47%''252691 ± 1714.00''3856 ± 0.28%''3957 ± 27'            │ 3808    │
└─────────┴────────────────────┴───────────────────┴───────────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 14.420x
inversifyCurrent vs NestJS Speedup: 0.160x
inversifyCurrent vs tsyringe Speedup: 0.753x
[ESM] Running benchmarks...

Get service in singleton scope
┌─────────┬────────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''260.18 ± 1.17%''250.00 ± 9.00''3968950 ± 0.01%''4000000 ± 149378'     │ 3843538 │
│ 1       │ 'inversify6''946.10 ± 3.45%''861.00 ± 10.00''1147772 ± 0.01%''1161440 ± 13648'      │ 1056972 │
│ 2       │ 'NestJS''304.38 ± 0.45%''281.00 ± 9.00''3466732 ± 0.01%''3558719 ± 110443'     │ 3285330 │
│ 3       │ 'tsyringe''311.10 ± 1.50%''281.00 ± 10.00''3505977 ± 0.01%''3558719 ± 122293'     │ 3214444 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 3.458x
inversifyCurrent vs NestJS Speedup: 1.145x
inversifyCurrent vs tsyringe Speedup: 1.132x

Get service in transient scope
┌─────────┬────────────────────┬──────────────────┬───────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns) │ Latency med (ns)  │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼──────────────────┼───────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''511.71 ± 0.50%''481.00 ± 10.00''2051971 ± 0.01%''2079002 ± 44140'      │ 1954235 │
│ 1       │ 'inversify6''4862.2 ± 3.21%''4519.0 ± 71.00''217827 ± 0.03%''221288 ± 3532'        │ 205670  │
│ 2       │ 'NestJS''9231.7 ± 1.48%''7995.0 ± 170.00''121775 ± 0.07%''125078 ± 2619'        │ 108323  │
│ 3       │ 'tsyringe''464.94 ± 0.69%''431.00 ± 10.00''2293255 ± 0.01%''2320186 ± 55111'      │ 2150799 │
└─────────┴────────────────────┴──────────────────┴───────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 9.420x
inversifyCurrent vs NestJS Speedup: 16.850x
inversifyCurrent vs tsyringe Speedup: 0.895x

Get complex service in singleton scope
┌─────────┬────────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''273.49 ± 1.61%''261.00 ± 10.00''3770168 ± 0.01%''3831418 ± 152646'     │ 3656426 │
│ 1       │ 'inversify6''931.74 ± 2.88%''861.00 ± 10.00''1150642 ± 0.01%''1161440 ± 13648'      │ 1073261 │
│ 2       │ 'NestJS''339.32 ± 0.75%''311.00 ± 9.00''3135071 ± 0.01%''3215434 ± 90434'      │ 2947095 │
│ 3       │ 'tsyringe''324.85 ± 0.57%''301.00 ± 10.00''3258762 ± 0.01%''3322259 ± 106825'     │ 3078376 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 3.277x
inversifyCurrent vs NestJS Speedup: 1.203x
inversifyCurrent vs tsyringe Speedup: 1.157x

Get complex service in transient scope
┌─────────┬────────────────────┬───────────────────┬───────────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns)  │ Latency med (ns)      │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼───────────────────┼───────────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'inversifyCurrent''230871 ± 0.70%''219889 ± 2414.00''4432 ± 0.30%''4548 ± 50'            │ 4332    │
│ 1       │ 'inversify6''4673036 ± 1.34%''4768436 ± 336316.50''216 ± 1.19%''210 ± 16'             │ 214     │
│ 2       │ 'NestJS''60341 ± 1.37%''53590 ± 661.00''18095 ± 0.18%''18660 ± 230'          │ 16573   │
│ 3       │ 'tsyringe''243043 ± 0.67%''231281 ± 1223.00''4207 ± 0.31%''4324 ± 23'            │ 4115    │
└─────────┴────────────────────┴───────────────────┴───────────────────────┴────────────────────────┴────────────────────────┴─────────┘
inversifyCurrent vs inversify6 Speedup: 20.535x
inversifyCurrent vs NestJS Speedup: 0.245x
inversifyCurrent vs tsyringe Speedup: 1.054x

@notaphplover notaphplover merged commit a6b0099 into main Mar 7, 2025
8 checks passed
@notaphplover notaphplover deleted the fix/false-positive-circular-dependencies branch March 7, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant