NSAmelchev opened a new pull request, #13868: URL: https://github.com/apache/ignite/pull/13868
### Problem `ExpressionFactoryImpl` caches compiled expressions by a string digest. The digest is built from the expression tree on every request: an index scan by a primary key requests four expressions (project, filter, lower and upper bounds), so every execution builds four strings, hashes them and compares them with the cached keys. ### Fix One more cache is checked first. Its key is the expressions themselves, compared by identity, together with the row type and the kind of the scalar. A cached plan passes the same expression instances on every execution, so the digest is built only on a miss, and then the existing cache is used as before. Expressions are compared by identity on purpose: equal expressions can differ in details the digest takes into account (see IGNITE-18282 and IGNITE-23435). The new cache is bounded by 1024 entries, like the existing one, and keeps references to the expressions, including the ones of plans already evicted from the plan cache. ### Benchmark JMH, one embedded server node, 1024 partitions, table `KV (ID INT PRIMARY KEY, VAL VARCHAR)` with 100,000 rows, 1 thread, ARM (Apple Silicon), OpenJDK 17. | Query | master, ops/s | PR, ops/s | Diff | master, B/op | PR, B/op | Diff | |--------------------------------------|---------------|-----------|--------|--------------|----------|--------| | `SELECT VAL FROM KV WHERE ID = ?` | 38,038 | 38,626 | +1.5 % | 39,982 | 37,432 | -6.4 % | | `UPDATE KV SET VAL = ? WHERE ID = ?` | 27,948 | 29,185 | +4.4 % | 53,591 | 48,699 | -9.1 % | -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
