Performance & crash fixes for chess.com#8546
Open
awesomekling wants to merge 7 commits intoLadybirdBrowser:masterfrom
Open
Performance & crash fixes for chess.com#8546awesomekling wants to merge 7 commits intoLadybirdBrowser:masterfrom
awesomekling wants to merge 7 commits intoLadybirdBrowser:masterfrom
Conversation
tcl3
reviewed
Mar 21, 2026
This is a normal spec-mandated early return, not an error condition. The already-started flag exists because prepare_script() is called from multiple paths (attribute changes, child insertions, DOM connection) and only the first call should proceed.
This is another normal spec early return in prepare_script(), not an error worth logging.
Instead of appending and re-sorting the entire records vector on every insert (O(n log n)), use binary search to find the correct insertion position and insert directly (O(log n) comparisons + O(n) shift).
Use AK::binary_search instead of a linear find_if scan in has_record_with_key(), taking advantage of the fact that records are kept sorted by key.
Since records are sorted by key, records matching a key range form a contiguous block. Use binary search to find the range boundaries and remove the block in one operation, instead of scanning every record with is_in_range().
Wrap the SerializationRecord (Vector<u8, 1024>) in an OwnPtr so that each ObjectStoreRecord is only ~16 bytes instead of ~1040+ bytes. This makes Vector operations on the records list dramatically cheaper since memmove now shifts pointers instead of kilobyte-sized buffers.
When a CSS animation keyframe uses var() referencing a nonexistent or invalid custom property, variable substitution produces a guaranteed-invalid value. The animation keyframe processing code did not handle this case, allowing the value to reach compute_opacity() (and similar functions) which would hit VERIFY_NOT_REACHED(). Fix this by skipping guaranteed-invalid values in compute_keyframe_values, matching how the regular cascading code treats them. This fixes a crash on chess.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three things here:
It's funny, I figured the sluggishness on chess.com was the chess engine, but it turns out it was just IndexedDB being inefficient 😅
(Although note that the chess engine is still slow, running as Wasm in the WebWorker process.)