question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Opaque performance issue using `.setValue`

See original GitHub issue

In two separate applications that both make use of .setValue, Codemirror calls different functions internally. It’s unclear to me why the performance is so radically different. I removed all calls to other functions and am now only calling .setValue.

The one thing that is different in both applications are the CSS styles. One uses flexbox, the other fixed heights.

Here is the call-chain of functions called in either version. Can upload profiles as well. @marijnh any ideas?

FAST:

  • anonymous
    • anonymous
      • makeChange
        • makeChangeInner
          • makeChangeSingleDoc
            • makeChangeSingleDocInEditor
              • startWorker
                • Delayed.set
                  • setTimeout
    • endOperation
      • endOperations
        • endOperation_W1
          • updateDisplayIfNeeded
            • patchDisplay
              • updateForLineChanges
                • updateLineText
                  • getLineContent
                    • buildLineContent
                  • replaceChild
        • endOperationR2
          • updateHeightsInViewport (selftime: 0.9 ms)

Total Duration: 2.6 ms

SLOW:

  • anonymous
    • anonymous
      • makeChange
        • filterChange
          • Codemirror.signal
        • makeChangeInner
          • computeSelAfterChange
            • normalizeSelection
          • addChangeToHistory
            • historyChangeFromChange
              • attachLocalSpans
        • makeChangeSingleDoc
          • makeChangeSingleDocInEditor
            • estimateHeight (selftime: 202 ms)
    • endOperation
      • endOperations
        • endOperation_R2
          • updateHeightsInViewport (selftime: 215 ms)
        • endOperation_finish
          • postUpdateDisplay
            • displayWidth (selftime: 230 ms)

Total Duration: 650 ms

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
den1kcommented, May 4, 2017

Use fixed width and height on the container of the editor element. On Thu, May 4, 2017 at 5:07 AM redlolgeerf notifications@github.com wrote:

i’ve encountered the same problem with very slow updateHeightsInViewport. are there any workarounds?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/codemirror/CodeMirror/issues/4076#issuecomment-299132652, or mute the thread https://github.com/notifications/unsubscribe-auth/AEb7Ij5V17NbWz3XNFsi5pJRbhLdoj0Tks5r2ZU3gaJpZM4I48pD .

2reactions
marijnhcommented, Jul 21, 2017

It should be fairly easy to modify the code to use the viewport height/scroll offsets for computing which part is visible,

Unfortunately, no. To ensure that things are drawn before they are scrolled into view, CodeMirror uses a very involved scrolling model for its container.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Opaque performance issue using .setValue #4076 - GitHub
The problem was that the Codemirror editor instance's height css property was set to inherit . Once we set a fixed height, we...
Read more >
Improve performance on getting/setting values to properties ...
Improve performance on getting/setting values to properties on objects created from class created by reflection. Save this question. Show ...
Read more >
Performance issues with setValue() - Retool Forum
I am setting the value of several Text Input fields in JS. Here is my code: var data = qrySources.data var rowID =...
Read more >
setValue() - Rocket Software Documentation
Sets the text of the specified field label.
Read more >
JDK-8092373 Improve Path rendering performance - Bug ID
I have noticed that if the map is quite complex, the zoom operation is very slow. For example, with a map with 20000...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found