[Oracle] Parse sets lazily to slash importer peak memory

- Add a raw JSON scanner that splits the document into per-set byte ranges
  without materializing the JSON tree
- Keep only the raw document bytes and parse one set at a time in startImport
- Take readSetsFromByteArray by value so the wizard's buffer is moved, not copied
- Clear the retained raw data in releaseSetData()/clear()
- Cover the scanner and lazy parsing with tests

Took 2 minutes
This commit is contained in:
Lukas Brübach 2026-08-30 13:39:40 +02:00 committed by BruebachL
parent 34d96d9fe5
commit 99d8db3398
8 changed files with 964 additions and 45 deletions

View file

@ -157,9 +157,10 @@ TEST(OracleBenchmark, ParseJsonThroughput)
for (int i = 0; i < iterations; ++i) {
OracleImporter importer;
QByteArray source = data;
QElapsedTimer timer;
timer.start();
bool ok = importer.readSetsFromByteArray(data);
bool ok = importer.readSetsFromByteArray(std::move(source));
ASSERT_TRUE(ok);
totalMs += timer.elapsed();
}
@ -448,7 +449,7 @@ TEST(OracleBenchmark, ImportRamUsage)
QElapsedTimer timer;
timer.start();
ASSERT_TRUE(importer.readSetsFromByteArray(data));
ASSERT_TRUE(importer.readSetsFromByteArray(std::move(data)));
const qint64 parseMs = timer.elapsed();
const MemorySnapshot afterParse = MemorySnapshot::current();
@ -540,7 +541,7 @@ TEST(OracleBenchmark, ImportRamUsageAllPrintings)
QElapsedTimer timer;
timer.start();
ASSERT_TRUE(importer.readSetsFromByteArray(setsData));
ASSERT_TRUE(importer.readSetsFromByteArray(std::move(setsData)));
const qint64 parseMs = timer.elapsed();
const MemorySnapshot afterParse = MemorySnapshot::current();