1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Merge pull request #3265 from smoogipoo/storyboard-hotpath

Slightly improve performance of beatmap/storyboard parsing
This commit is contained in:
Dean Herbert 2018-08-21 12:10:37 +09:00 committed by GitHub
commit 9182302254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps.Formats
if (ShouldSkipLine(line))
continue;
if (line.StartsWith(@"[") && line.EndsWith(@"]"))
if (line.StartsWith(@"[", StringComparison.Ordinal) && line.EndsWith(@"]", StringComparison.Ordinal))
{
if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section))
{
@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps.Formats
}
}
protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//");
protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//", StringComparison.Ordinal);
protected virtual void ParseLine(T output, Section section, string line)
{

View File

@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps.Formats
private void handleEvents(string line)
{
var depth = 0;
while (line.StartsWith(" ") || line.StartsWith("_"))
while (line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal))
{
++depth;
line = line.Substring(1);