KconfigIni: stream parse ini files
Detect when a file does not look like a valid ini file when in 1024 bytes no '\n' was detected.
And stop processing when a file accumulates more than 100 errors.
Consequently, this removes there interned string cache.
There is a small tradeoff, because we can't intern the key/values anymore.
This shouldn't use less or more memory except in cases the interned strings paid off a lot.
Perf-wise, this seems neutral at worse, slightly better in KConfigBenchmark::testHasKey at best:
Before:
********* Start testing of KConfigBenchmark *********
Config: Using QtTest library 6.9.2, Qt 6.9.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 15.2.1 20250813), arch unknown
PASS : KConfigBenchmark::initTestCase()
PASS : KConfigBenchmark::testHasKey()
RESULT : KConfigBenchmark::testHasKey():
0.000192 msecs per iteration (total: 101, iterations: 524288)
PASS : KConfigBenchmark::testReadEntry()
RESULT : KConfigBenchmark::testReadEntry():
0.00020 msecs per iteration (total: 55, iterations: 262144)
PASS : KConfigBenchmark::testKConfigGroupKeyList()
RESULT : KConfigBenchmark::testKConfigGroupKeyList():
0.000192 msecs per iteration (total: 101, iterations: 524288)
PASS : KConfigBenchmark::cleanupTestCase()
Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted, 960ms
********* Finished testing of KConfigBenchmark *********
-perf:
Config: Using QtTest library 6.9.2, Qt 6.9.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 15.2.1 20250813), arch unknown
PASS : KConfigBenchmark::initTestCase()
PASS : KConfigBenchmark::testHasKey()
RESULT : KConfigBenchmark::testHasKey():
10,700 nsecs per iteration (total: 10,700, iterations: 1)
16,919 CPU cycles per iteration, 1,58 GHz (total: 16,919, iterations: 1)
7,673 instructions per iteration, 0,454 instr/cycle (total: 7,673, iterations: 1)
1,987 branch instructions per iteration, 186 M/sec (total: 1,987, iterations: 1)
PASS : KConfigBenchmark::testReadEntry()
RESULT : KConfigBenchmark::testReadEntry():
9,920 nsecs per iteration (total: 9,920, iterations: 1)
16,133 CPU cycles per iteration, 1,63 GHz (total: 16,133, iterations: 1)
8,034 instructions per iteration, 0,498 instr/cycle (total: 8,034, iterations: 1)
2,048 branch instructions per iteration, 206 M/sec (total: 2,048, iterations: 1)
PASS : KConfigBenchmark::testKConfigGroupKeyList()
RESULT : KConfigBenchmark::testKConfigGroupKeyList():
12,320 nsecs per iteration (total: 12,320, iterations: 1)
19,345 CPU cycles per iteration, 1,57 GHz (total: 19,345, iterations: 1)
7,495 instructions per iteration, 0,387 instr/cycle (total: 7,495, iterations: 1)
1,967 branch instructions per iteration, 160 M/sec (total: 1,967, iterations: 1)
PASS : KConfigBenchmark::cleanupTestCase()
Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted, 21ms
********* Finished testing of KConfigBenchmark *********
After:
********* Start testing of KConfigBenchmark *********
Config: Using QtTest library 6.9.2, Qt 6.9.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 15.2.1 20250813), arch unknown
PASS : KConfigBenchmark::initTestCase()
PASS : KConfigBenchmark::testHasKey()
RESULT : KConfigBenchmark::testHasKey():
0.00018 msecs per iteration (total: 99, iterations: 524288)
PASS : KConfigBenchmark::testReadEntry()
RESULT : KConfigBenchmark::testReadEntry():
0.00020 msecs per iteration (total: 53, iterations: 262144)
PASS : KConfigBenchmark::testKConfigGroupKeyList()
RESULT : KConfigBenchmark::testKConfigGroupKeyList():
0.000192 msecs per iteration (total: 101, iterations: 524288)
PASS : KConfigBenchmark::cleanupTestCase()
Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted, 1032ms
********* Finished testing of KConfigBenchmark *********
-perf:
********* Start testing of KConfigBenchmark *********
Config: Using QtTest library 6.9.2, Qt 6.9.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 15.2.1 20250813), arch unknown
PASS : KConfigBenchmark::initTestCase()
PASS : KConfigBenchmark::testHasKey()
RESULT : KConfigBenchmark::testHasKey():
10,659 nsecs per iteration (total: 10,659, iterations: 1)
16,789 CPU cycles per iteration, 1,58 GHz (total: 16,789, iterations: 1)
7,668 instructions per iteration, 0,457 instr/cycle (total: 7,668, iterations: 1)
1,987 branch instructions per iteration, 186 M/sec (total: 1,987, iterations: 1)
PASS : KConfigBenchmark::testReadEntry()
RESULT : KConfigBenchmark::testReadEntry():
9,870 nsecs per iteration (total: 9,870, iterations: 1)
16,349 CPU cycles per iteration, 1,66 GHz (total: 16,349, iterations: 1)
8,029 instructions per iteration, 0,491 instr/cycle (total: 8,029, iterations: 1)
2,048 branch instructions per iteration, 207 M/sec (total: 2,048, iterations: 1)
PASS : KConfigBenchmark::testKConfigGroupKeyList()
RESULT : KConfigBenchmark::testKConfigGroupKeyList():
12,640 nsecs per iteration (total: 12,640, iterations: 1)
20,190 CPU cycles per iteration, 1,6 GHz (total: 20,190, iterations: 1)
7,490 instructions per iteration, 0,371 instr/cycle (total: 7,490, iterations: 1)
1,967 branch instructions per iteration, 156 M/sec (total: 1,967, iterations: 1)
PASS : KConfigBenchmark::cleanupTestCase()
Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted, 35ms
********* Finished testing of KConfigBenchmark *********
Edited by Méven Car