{LYN-4224} Fix for the file scan slowdown (#1183)
* {LYN-4224} Fix for the file scan slowdown
* Fixed a slowdown in the file scanning logic
* Improved the file scanning logic from previous code by 40%
Tests:
Using Testing\Pytest\AutomatedTesting_BlastTest
old code:
=== 7 passed in 96.13s (0:01:36) ===
current code:
=== 7 passed in 160.45s (0:02:40) ====
newest code:
=== 7 passed in 52.91s ===
* fixing a unit test compile error
* unit test fixes
* another file improvement
* fix for legacy level loading taking too long
* making an enum for the search types
* switched the enum to "allow" types to make the input more clear
This commit is contained in:
@@ -36,14 +36,14 @@ namespace CustomMocks
|
||||
: m_levelName(levelName)
|
||||
{}
|
||||
|
||||
AZ::IO::ArchiveFileIterator FindFirst([[maybe_unused]] AZStd::string_view dir, [[maybe_unused]] unsigned int flags, [[maybe_unused]] bool allowUseFileSystem) override
|
||||
AZ::IO::ArchiveFileIterator FindFirst([[maybe_unused]] AZStd::string_view dir, AZ::IO::IArchive::EFileSearchType) override
|
||||
{
|
||||
AZ::IO::FileDesc fileDesc;
|
||||
fileDesc.nSize = sizeof(AZ::IO::FileDesc);
|
||||
// Add a filename and file description reference to the TestFindData map to make sure the file iterator is valid
|
||||
AZStd::intrusive_ptr<TestFindData> findData = new TestFindData{};
|
||||
findData->m_mapFiles.emplace(m_levelName, fileDesc);
|
||||
return findData->Fetch();
|
||||
m_findData = new TestFindData();
|
||||
m_findData->m_fileStack.emplace_back(AZ::IO::ArchiveFileIterator{ static_cast<AZ::IO::FindData*>(m_findData.get()), m_levelName, fileDesc });
|
||||
return m_findData->Fetch();
|
||||
}
|
||||
|
||||
AZ::IO::ArchiveFileIterator FindNext(AZ::IO::ArchiveFileIterator iter) override
|
||||
@@ -54,13 +54,14 @@ namespace CustomMocks
|
||||
// public: for easy resetting...
|
||||
AZStd::string m_levelName;
|
||||
|
||||
|
||||
// Add an inherited FindData class to control the adding of a mapfile which indicates that a FileIterator is valid
|
||||
struct TestFindData
|
||||
: AZ::IO::FindData
|
||||
{
|
||||
using AZ::IO::FindData::m_mapFiles;
|
||||
using AZ::IO::FindData::m_fileStack;
|
||||
};
|
||||
|
||||
AZStd::intrusive_ptr<TestFindData> m_findData;
|
||||
};
|
||||
|
||||
} // namespace CustomMocks
|
||||
|
||||
Reference in New Issue
Block a user