Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Tue, 01 Jul 2025 15:50:38 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3693: Overhead of uncontended use of ResourceLock In-Reply-To: References: List-Id: X-GitHub-Author-Login: vlsi X-GitHub-Comment-Id: 3024598185 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2025-07-01T15:51:01Z X-GitHub-Issue: 3693 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3693#issuecomment-3024598185 Content-Type: text/plain; charset=utf-8 Apparently, the major part of `ResourceLock` overhead comes from * `org.postgresql.core.QueryExecutorBase#setTransactionState` (we could make a private variation that does not grab the lock) * `LruCache.borrow/put` <-- we could replace this with `synchronized` (the cache does not execute IO, so it is loom-safe with all JDKs) * `org.postgresql.jdbc.PgStatement#executeInternal` <-- this is probably executed under a lock, thus synchronization there might be removed I wonder if it can make noticeable difference with benchmark like https://github.com/pgjdbc/pgjdbc/blob/5be3c937cc6bdc1c753634881195cf0a0f7bb8c1/benchmarks/src/jmh/java/org/postgresql/benchmark/statement/ProcessResultSet.java Image Image