Skip to content

Commit

Permalink
More notes about add-tags code improvements to be done
Browse files Browse the repository at this point in the history
  • Loading branch information
FenPhoenix committed Aug 15, 2023
1 parent 452e22d commit 8f48eb3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions AngelLoader/FMTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,27 @@ internal static bool TryGetCatAndTag(string item, out string cat, out string tag
return true;
}

// Very awkward procedure that accesses global state in the name of only doing one iteration
/*
Very awkward procedure that accesses global state in the name of only doing one iteration
@vNext(AddTagsToFMAndGlobalList): The set of tags adding stuff in here is very awkwardly coupled
We did it so we can keep this one loop instead of two, but that's a stupid micro-optimization that almost
certainly gains us nothing perceptible but makes the logic in here very difficult to follow.
We should pull these apart and put them back together in a better way.
*/
internal static void AddTagsToFMAndGlobalList(
string tagsToAdd,
FMCategoriesCollection existingFMTags,
bool addToGlobalList = true)
{
if (tagsToAdd.IsWhiteSpace()) return;

// @MEM(AddTagsToFMAndGlobalList/string.Split): This runs for every FM on startup, we could use the array-renting version
// Although the UI load is still the bottleneck, so speeding this up wouldn't actually decrease startup
// time at all. Meh.
/*
@MEM(AddTagsToFMAndGlobalList/string.Split): This runs for every FM on startup, we could use the array-renting version
Although the UI load is still the bottleneck, so speeding this up wouldn't actually decrease startup
time at all. Meh.
Also, this returned array is also temporary, we really just want the substrings out of the main string,
and the Split array is just the easiest way to do it, but it's not actually necessary for the task at hand.
*/
string[] tagsArray = tagsToAdd.Split(CA_CommaSemicolon, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < tagsArray.Length; i++)
{
Expand Down

0 comments on commit 8f48eb3

Please sign in to comment.