Skip to content

EditContext.text can be problematic from performance point of view #107

Description

@smaug----

If the modified text becomes long and the JS side accesses .text regularly, maintaining the string may become slow and also use quite a bit memory and cause lots of memory churn.
On IRC @dandclark suggested
"we'll probably want to add an additional getText()/setText() that take a start index and a length or end index."

Activity

  1. johanneswilm commented on Dec 11, 2025

    @johanneswilm
    Contributor

    TPAC 2025:

    Ashish
    .text attribute might be problematic from the performance point of view.
    Smaug
    Implementation doesn’t have to have this as a big chunk of memory
    Did you test this?
    Rohan
    Is the concern that the text might occupy memory?
    Smaug
    Reallocation-based problems
    Johannes
    .text vs the accessor methods
    Rohan
    Let’s have both .text and .set/get methods
    Johannes
    It would be good
    Smaug
    (agrees)
    Johannes
    So, the proposal from Dan is to add those two methods
    The proposal in the room now is to add them in addition to the current .text so that we do not break anything
    Megan
    No problem with that
    Ashish
    We have to explore that
    Johannes
    Resolutions here may be withdrawn within 2 weeks, tell if you encounter problems
    We have a resolution: add this in addition to the current thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions