Skip to content

Reduce per-request allocation in ThreadSafeCookieStore.get()#2201

Merged
hyperxpro merged 1 commit into
mainfrom
threadsafecookiestore-allocation
Jun 15, 2026
Merged

Reduce per-request allocation in ThreadSafeCookieStore.get()#2201
hyperxpro merged 1 commit into
mainfrom
threadsafecookiestore-allocation

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

Motivation:

ThreadSafeCookieStore.get() ran a Stream.filter().map().collect() pipeline per sub-domain level on every cookie-enabled request, allocating the pipeline, collector, and capturing lambdas each call.

Modification:

Replaced the Stream pipeline with an imperative scan that appends matches straight into a single lazily-allocated result list.

Result:

Lower allocation and GC pressure on the cookie lookup path, which runs on every cookie-enabled request; returned cookies are unchanged.

@hyperxpro hyperxpro force-pushed the threadsafecookiestore-allocation branch from 97f3218 to 5b3a98e Compare June 15, 2026 22:20
@hyperxpro hyperxpro merged commit 31829fe into main Jun 15, 2026
17 of 19 checks passed
@hyperxpro hyperxpro deleted the threadsafecookiestore-allocation branch June 15, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant