Skip to content

Conversation

@gh123man
Copy link
Owner

@gh123man gh123man commented Mar 8, 2025

This PR optimizes the hot path by removing generics from the internal channel implementation.
Most of the existing performance overhead was caused by runtime generics due to lack of specialization - especially for buffered channel benchmarks.

This PR improves the benchmarks across the board, and in some cases 2x+ improvements are observed (especially for buffered channel benchmarks).

Using a single concrete type internally prevents the compiler form having to resolve generics for the hot path. As a result, I was able to use Deque instead of LinkedList which provided further improvements.

@gh123man gh123man changed the title Remove Internal Generics Optimize performance by removing internal generics Mar 24, 2025
@gh123man gh123man merged commit 13fe42e into main Mar 24, 2025
2 checks passed
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.

2 participants