97d9c4c7083a12d177be91ffc81b690e33483292 | Author: Benoit TELLIER <btellier@linagora.com>
| 2022-11-19 05:39:48+07:00
Optimizations for TypeSafeDriverConfig (#1616)
* TypesafeDriverConfig: getProfile can avoid calling containsKey
On a typical applicative workload, 0.53% of CPU is spend resolving
configuration profiles. By getting the profile first and failing if it
is null we can easily cut that in half.
* TypesafeDriverConfig: optimize getDefaultProfile
We could easily get a dedicated field for the default profile thus
avoiding recurring maps lookups.
* fixup! TypesafeDriverConfig: optimize getDefaultProfile
0351c4fa0297332054114dc730c7ab460650fa55 | Author: Benoit TELLIER <btellier@linagora.com>
| 2022-11-16 02:54:54+07:00
Improve IdentifierIndex firstIndexOf performance (#1615)
* Improve IdentifierIndex firstIndexOf performance
Avoids doing two hasmap lookups and instead does a
single one, thus improving performances (CPU) of rougthly
33%.
In applications reading lots of rows and not managing manually indexes
(which is tricky, boiler plate and error prone),
IdentifierIndex::firstIndexOf is typically a CPU hotspots. In reactive
applications it might even run on the driver event loop. As such,
performances gains here are welcome.
## Before
```
Benchmark Mode Cnt Score Error Units
IdentifierIndexBench.complexGetFirst avgt 5 0.046 ± 0.005 us/op
IdentifierIndexBench.simpleGetFirst avgt 5 0.046 ± 0.002 us/op
```
## After
```
Benchmark Mode Cnt Score Error Units
IdentifierIndexBench.complexGetFirst avgt 5 0.028 ± 0.002 us/op
IdentifierIndexBench.simpleGetFirst avgt 5 0.030 ± 0.002 us/op
```
* Use ImmutableListMultimap within IdentifierIndex
This unlocks massive performance gains upon reads, for a minor slow
down at instanciation time, which won't be felt by applications relying
on prepared statements.
## Before
```
Benchmark Mode Cnt Score Error Units
IdentifierIndexBench.complexAllIndices avgt 5 0.007 ± 0.001 us/op
IdentifierIndexBench.complexGetFirst avgt 5 0.026 ± 0.002 us/op
IdentifierIndexBench.createComplex avgt 5 0.759 ± 0.059 us/op
IdentifierIndexBench.createSimple avgt 5 0.427 ± 0.048 us/op
IdentifierIndexBench.simpleAllIndices avgt 5 0.007 ± 0.001 us/op
IdentifierIndexBench.simpleGetFirst avgt 5 0.027 ± 0.002 us/op
```
## After
```
Benchmark Mode Cnt Score Error Units
IdentifierIndexBench.complexAllIndices avgt 5 0.004 ± 0.001 us/op
IdentifierIndexBench.complexGetFirst avgt 5 0.005 ± 0.001 us/op
IdentifierIndexBench.createComplex avgt 5 0.680 ± 0.020 us/op
IdentifierIndexBench.createSimple avgt 5 0.538 ± 0.096 us/op
IdentifierIndexBench.simpleAllIndices avgt 5 0.004 ± 0.001 us/op
IdentifierIndexBench.simpleGetFirst avgt 5 0.005 ± 0.001 us/op
```