merge_message_runs is O(n^2) in run length for list/content-block messages
Merging consecutive same-type messages with list content blocks re-validates the growing message on every step, causing quadratic runtime and freezing on long runs.

Tech tag
Published reports that match this technical term, gathered from the local catalog.
Merging consecutive same-type messages with list content blocks re-validates the growing message on every step, causing quadratic runtime and freezing on long runs.
The helper function _get_data_content_block_types() reconstructs its result from get_args and get_type_hints on every call, even though the result is immutable at runtime. This is called repeatedly by is_data_content_block, leading to ~23ms CPU per ChatOpenAI payload for a 204-message history, blocking the event loop in async applications.
TextSplitter._merge_splits uses repeated list slicing (current_doc = current_doc[1:]) inside the eviction loop, causing O(k^2) reference copies when chunks contain many small split pieces. The proposed optimization counts leading pieces to remove and slices once, preserving existing semantics.