Reduce array allocations

This commit is contained in:
Matt Nadareski
2024-10-24 05:33:28 -04:00
parent e992f0d013
commit 15e30d7a75
6 changed files with 21 additions and 13 deletions

View File

@@ -44,6 +44,7 @@ contents of any changed dats.";
// Get feature flags
int workers = GetInt32(features, WorkersInt32Value);
string? missingSha1s = GetString(features, MissingSha1sStringValue);
HashType[] hashes = [HashType.CRC32, HashType.MD5, HashType.SHA1];
// Make sure the db is set
if (string.IsNullOrWhiteSpace(_db))
@@ -69,7 +70,7 @@ contents of any changed dats.";
// First get a list of SHA-1's from the input DATs
DatFile datroot = DatFile.Create();
datroot.Header.SetFieldValue<string?>(SabreTools.Models.Metadata.Header.TypeKey, "SuperDAT");
DatFromDir.PopulateFromDir(datroot, _dats, asFiles: TreatAsFile.NonArchive, hashes: [HashType.CRC32, HashType.MD5, HashType.SHA1]);
DatFromDir.PopulateFromDir(datroot, _dats, asFiles: TreatAsFile.NonArchive, hashes: hashes);
datroot.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
// Create a List of dat hashes in the database (SHA-1)