shortcut common cases in hot code paths

This commit is contained in:
Jesse Plamondon-Willard 2022-05-23 12:19:06 -04:00
parent 2ab2182645
commit 62665649bd
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 4 additions and 0 deletions

View File

@ -95,6 +95,9 @@ namespace StardewModdingAPI.Framework.Deprecations
/// <summary>Print any queued messages.</summary> /// <summary>Print any queued messages.</summary>
public void PrintQueued() public void PrintQueued()
{ {
if (!this.QueuedWarnings.Any())
return;
foreach (DeprecationWarning warning in this.QueuedWarnings.OrderBy(p => p.ModName).ThenBy(p => p.NounPhrase)) foreach (DeprecationWarning warning in this.QueuedWarnings.OrderBy(p => p.ModName).ThenBy(p => p.NounPhrase))
{ {
// build message // build message

View File

@ -596,6 +596,7 @@ namespace StardewModdingAPI.Framework
/********* /*********
** Execute commands ** Execute commands
*********/ *********/
if (this.ScreenCommandQueue.Value.Any())
{ {
var commandQueue = this.ScreenCommandQueue.Value; var commandQueue = this.ScreenCommandQueue.Value;
foreach ((Command? command, string? name, string[]? args) in commandQueue) foreach ((Command? command, string? name, string[]? args) in commandQueue)