Open ghost opened 8 years ago
I've updated to reflect the currently implemented API. Added a load of basic tests to ensure that it works. Will need to add a lot more to cover things like generics etc, but I should imagine that they will be fine.
Think @danielcirket was interested in some performance stuff? He has some numbers from local benchmarking that will be shared at somepoint. My local tests seem to indicate that the current implementation is faster from a cold start. I still need to think about the use of the concurrent dictionary inside the current implementation also.
https://github.com/sblackler/compose/pull/1 - Added some basic benchmarks for you @sblackler, super crappy way of doing it, need a better way of doing it to get the output etc, but at least gives an idea of the perf differences so far!
Done the PR to your WIP branch for now, but feel it should be mentioned here too.
Initial results from my machine (Times in milliseconds with 10k iterations):
new - Single Params | Min: 0 | Max: 0.6439 | Avg: 0.000204689999999994 new - No Params | Min: 0 | Max: 0.0885 | Avg: 0.000119879999999995 new - Multiple Params | Min: 0 | Max: 0.0147 | Avg: 0.000112559999999995
Activator - No Params | Min: 0 | Max: 0.0789 | Avg: 0.000201419999999988 Activator - Single Params | Min: 0.0009 | Max: 5.6403 | Avg: 0.00243510000000057 Activator - Multiple Params | Min: 0.0012 | Max: 0.8929 | Avg: 0.00159365000000024
Activate - No Params | Min: 0 | Max: 0.0153 | Avg: 0.00024144000000001 Activate - Single Params | Min: 0.0003 | Max: 0.2388 | Avg: 0.000391410000000064 Activate - Multiple Params | Min: 0.0003 | Max: 0.0472 | Avg: 0.000494850000000075
As per #104, we should probably have a way of quickly creating types with given arguments. Relying on
Activator.CreateInstance
is okay, but we can do better.Proposed API:
This would cover the current use cases of Compose. However, there might be need for a generic API in the future, this will be covered as an extension to this API in the future.