Skip to main content

Announcing 7.0.0-alpha.5

· 5 min read
Roberto Pintos López
InversifyJS maintainer

In this version, we are announcing more performance improvements!

BindingMetadata renamed to BindingConstraints

After thinking about it, we decided to rename BindingMetadata to BindingConstraints. We believe that this name better represents the purpose of the interface: representing the constraints associated to a certain binding.

Performance improvements

We have been working on improving the performance of the library. It now performs close to tsyringe, outperforming it in some scenarios. Further performance optimizations will be made in the future, but we are happy with the current 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' │ '294.58 ± 0.66%' │ '271.00 ± 9.00' │ '3592087 ± 0.01%' │ '3690037 ± 118608' │ 3394675 │
│ 1 │ 'inversify6' │ '1004.1 ± 2.17%' │ '922.00 ± 19.00' │ '1061639 ± 0.02%' │ '1084599 ± 21899' │ 995946 │
│ 2 │ 'tsyringe' │ '330.74 ± 3.28%' │ '310.00 ± 9.00' │ '3214288 ± 0.01%' │ '3225806 ± 96453' │ 3023493 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
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' │ '633.13 ± 0.36%' │ '601.00 ± 10.00' │ '1642649 ± 0.01%' │ '1663894 ± 27232' │ 1579464 │
│ 1 │ 'inversify6' │ '5259.8 ± 3.61%' │ '4909.0 ± 60.00' │ '200786 ± 0.03%' │ '203707 ± 2460' │ 190122 │
│ 2 │ 'tsyringe' │ '528.69 ± 0.54%' │ '481.00 ± 10.00' │ '2033055 ± 0.02%' │ '2079002 ± 44140' │ 1891458 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
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' │ '310.61 ± 1.80%' │ '281.00 ± 10.00' │ '3497460 ± 0.01%' │ '3558719 ± 131318' │ 3219428 │
│ 1 │ 'inversify6' │ '1016.4 ± 1.18%' │ '932.00 ± 11.00' │ '1051408 ± 0.02%' │ '1072961 ± 12815' │ 983865 │
│ 2 │ 'tsyringe' │ '323.07 ± 0.74%' │ '291.00 ± 9.00' │ '3336380 ± 0.01%' │ '3436426 ± 103093' │ 3095287 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
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' │ '347315 ± 0.95%' │ '334639 ± 2224.00' │ '2921 ± 0.30%' │ '2988 ± 20' │ 2880 │
│ 1 │ 'inversify6' │ '4778396 ± 1.17%' │ '4569745 ± 48942.50' │ '210 ± 0.91%' │ '219 ± 2' │ 210 │
│ 2 │ 'tsyringe' │ '234380 ± 0.52%' │ '224692 ± 1392.00' │ '4335 ± 0.28%' │ '4451 ± 28' │ 4267 │
└─────────┴────────────────────┴───────────────────┴──────────────────────┴────────────────────────┴────────────────────────┴─────────┘
[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' │ '254.83 ± 0.68%' │ '241.00 ± 10.00' │ '4042055 ± 0.01%' │ '4149378 ± 165314' │ 3924178 │
│ 1 │ 'inversify6' │ '941.12 ± 3.69%' │ '852.00 ± 10.00' │ '1153040 ± 0.01%' │ '1173709 ± 13940' │ 1062564 │
│ 2 │ 'tsyringe' │ '282.98 ± 0.42%' │ '261.00 ± 9.00' │ '3713697 ± 0.01%' │ '3831418 ± 127714' │ 3533782 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
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' │ '500.08 ± 0.49%' │ '471.00 ± 10.00' │ '2092141 ± 0.01%' │ '2123142 ± 44140' │ 1999673 │
│ 1 │ 'inversify6' │ '5020.6 ± 4.42%' │ '4649.0 ± 40.00' │ '212127 ± 0.03%' │ '215100 ± 1867' │ 199179 │
│ 2 │ 'tsyringe' │ '450.30 ± 0.50%' │ '421.00 ± 10.00' │ '2346200 ± 0.01%' │ '2375297 ± 57793' │ 2220732 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
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' │ '276.74 ± 1.70%' │ '261.00 ± 9.00' │ '3730378 ± 0.01%' │ '3831418 ± 127714' │ 3613563 │
│ 1 │ 'inversify6' │ '945.43 ± 2.05%' │ '872.00 ± 10.00' │ '1127286 ± 0.01%' │ '1146789 ± 13304' │ 1057716 │
│ 2 │ 'tsyringe' │ '322.27 ± 2.72%' │ '291.00 ± 9.00' │ '3361154 ± 0.01%' │ '3436426 ± 103093' │ 3102969 │
└─────────┴────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
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' │ '235090 ± 0.46%' │ '227829 ± 1542.00' │ '4299 ± 0.23%' │ '4389 ± 30' │ 4254 │
│ 1 │ 'inversify6' │ '4593344 ± 0.83%' │ '4714087 ± 295530.50' │ '219 ± 0.83%' │ '212 ± 14' │ 218 │
│ 2 │ 'tsyringe' │ '239653 ± 0.47%' │ '230524 ± 2385.00' │ '4231 ± 0.28%' │ '4338 ± 45' │ 4173 │
└─────────┴────────────────────┴───────────────────┴───────────────────────┴────────────────────────┴────────────────────────┴─────────┘