mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
Review usage of string.Substring (part 1)
Reduced allocations by replacing string.Substring with ReadOnlySpan<char>.Slice
This commit is contained in:
@@ -35,7 +35,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.StartsWith("["))
|
||||
if (line[0] == '[')
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
return trackInfo;
|
||||
}
|
||||
|
||||
long GetTicks(string time)
|
||||
private long GetTicks(ReadOnlySpan<char> time)
|
||||
{
|
||||
return TimeSpan.TryParseExact(time, @"h\:mm\:ss\.ff", _usCulture, out var span)
|
||||
? span.Ticks : 0;
|
||||
|
||||
Reference in New Issue
Block a user