Avoid allocations when rewriting queries without value expressions

Aperta
#3,536 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

  • #3537 di @gregjotau — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
64/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Inizia con ValueExpressionQueryRewriter e segui la prima ricerca del matcher, la convalida delle virgolette e la gestione della mappa dei parametri. Aggiungi il percorso senza espressione preservando il riutilizzo della stringa di input e i metadati delle virgolette, quindi verifica test mirati per testo tra virgolette, virgolette non bilanciate ed espressioni reali insieme al benchmark JMH permanente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: enhancement

Spring Data Commons 4.2.0-SNAPSHOT constructs a mutable expression map, a rewritten query string, and a second quotation map for every query passed to ValueExpressionQueryRewriter, even when the query contains no value expression. Ordinary repository queries commonly take this path.

A no-expression fast path can retain the initial matcher and quotation-map construction, then reuse the original query string and an immutable empty parameter map when the first matcher search finds nothing. This preserves unbalanced-quotation validation and quotation metadata.

JMH on JDK 26, with three forks and the GC profiler, measured the ordinary-query path at 608.007 B/op before and 232.004 B/op after the fast path, a deterministic 61.8% allocation reduction. Independent negative controls were unchanged to measurement precision: quoted expression-like text remained 1,368 B/op and an actual expression remained 9,576 B/op.

A separate 729-query fresh-JVM batch used 30 forks, no warmup, SingleShotTime, and 99.9% confidence intervals. It improved from 7.577 ± 0.845 ms and 1.422 MB to 5.349 ± 0.201 ms and 1.008 MB, reducing both time and allocation by about 29%.

The proposed change includes focused tests for input-string reuse, retained quotation information, unbalanced quotations, real expressions, and expression-like text inside quotes, plus a permanent JMH benchmark.

Lingua principale
Java
Stelle
842
Fork
745
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di spring-projects/spring-data-commons

Tutte le issue di spring-projects/spring-data-commons

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.