Skip to content

Extreme lagging on Langsmith Playground #2719

Description

Description

  • Langsmith playground extreme lagging appeared in the last week or so
  • Loading an llm call in plaground (via trace) loads frozed + brings up chrome 'wait for page' toast
  • Adding a new message box takes ~60 seconds to respond
  • Typing in message box takes 4-5 seconds to render

=> Can someone take a look at this?

Steps to Reproduce

  1. Select an LLM call from trace (in this case ChatOpenAI ~40k context....not large)
  2. top right hand corner, click on 'Playground'
  3. Wait for page to load....1 minute or more
  4. Click '+Message' ....wait some more
  5. Start typing...wait more
    => FYI: use case here is to open up a live chat and branch into to 'debrief' the agent / get their feedback...this is different from trying parallel calls on the same prompt. Generally as UI changes are made they tend to make the parallel call scenario easier and the 'debrief' scenario harder/extra steps (just FYI)

Expected / Observed Behaviour

No lag expected. Fairly unusable as is.

Notes

System RAM not exceptionally high (20/32gb used).
Windows 11 using Comet Version 145.0.7632.117 (Official Build) (64-bit) Perplexity build number: 5936

Dev tools:
(from keyboard typing).....its something in the background bottlenecking:

Image

Digging further on a single key stoke, it looks like the entire style sheet is being rendered for all 40k x 4-5 = 200k characters on the page on every key press

Image

Perplexity contributes its opinion:

Root cause identified: On every keystroke, a CSS-in-JS style mount is triggered. getRules() takes ~1,400ms to collect CSS rules, then set textContent takes ~3,060ms to write them to a <style> tag. This accounts for 79% of the 5,592ms interaction cost. ProseMirror/updatePlugins itself is only ~83ms and is not the issue. The fix is preventing style remounting on every editor transaction — either by memoising the style sheet, fixing a React re-render that's recreating CSS instances, or guarding the mountStyles call behind a dirty-check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions