You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Jab uses runtime checks to check if the newly created instance is a IDisposable or IAsyncDisposable, this could be done by the Jab in compile time improving the runtime performance.
So instead of this code to all new instances:
Jab.Performance.Basic.Transient.ITransient1 IServiceProvider<Jab.Performance.Basic.Transient.ITransient1>.GetService(){
Jab.Performance.Basic.Transient.Transient1 service=new Jab.Performance.Basic.Transient.Transient1();
TryAddDisposable(service);returnservice;}privateglobal::System.Collections.Generic.List<object>?_disposables;privatevoidTryAddDisposable(object?value){if(value isglobal::System.IDisposable || value is System.IAsyncDisposable)lock(this){(_disposables ??= newglobal::System.Collections.Generic.List<object>()).Add(value);}}
Update to this code only for new instances from IDisposable or IAsyncDisposable.
The text was updated successfully, but these errors were encountered:
rafaelsc
changed the title
Performance Improvements Suggestion: Removing the TryAddDisposable()
Performance Improvements Suggestion: Removing the TryAddDisposable()Jan 28, 2024
Currently, Jab uses runtime checks to check if the newly created instance is a
IDisposable
orIAsyncDisposable
, this could be done by the Jab in compile time improving the runtime performance.So instead of this code to all new instances:
Update to this code only for new instances from
IDisposable
orIAsyncDisposable
.and similar changes for
IAsyncDisposable
.See: #168 (comment)
The text was updated successfully, but these errors were encountered: