Skip to content

Commit

Permalink
Added little optimization for net8
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrohanea committed Nov 9, 2024
1 parent 7a0e3a9 commit a0278f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Whisper.net/WhisperFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ private WhisperFactory(IWhisperProcessorModelLoader loader, bool delayInit)
{
var nativeContext = loader.LoadNativeContext(libraryLoaded.Value.NativeWhisper!);
isEagerlyInitialized = true;

#if NET8_0_OR_GREATER
contextLazy = new Lazy<IntPtr>(nativeContext);
#else
contextLazy = new Lazy<IntPtr>(() => nativeContext);
#endif
}
else
{
Expand Down

0 comments on commit a0278f7

Please sign in to comment.