Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Append()ing normal ShortStrings (length ≦ 255) to Ropes, switch DOM implementation to using that, and use that for generating reference links #157

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Commits on Aug 9, 2023

  1. Allow Append()ing normal ShortStrings (length ≦ 255) to Ropes

    This change reverts 0ad4342 and increases to 255 the length of strings
    that can be passed directly to Rope≫Append() without getting truncated.
    Otherwise, without this change, any string passed directly to
    Rope≫Append() whose length exceeds a particular system-dependent limit
    (which in practice seems to be 15) will get silently truncated.
    
    Relates to #153.
    sideshowbarker committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    abe0b17 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2023

  1. Make the DOM implementation append strings directly

    This change makes the DOM implementation append strings directly when
    setting attribute values and when appending text nodes and comments.
    That in turn allows passing non-constant strings to Element≫AppendChild()
    and Document≫AppendChild() and Element≫SetAttribute().
    
    Otherwise, without this change, the strings we use for attribute values and
    text nodes and comments either must be constants, or else we have to create
    CutRopes, append strings to them, and then use TText.CreateDestructively()
    (to create text nodes and comments) and Element≫SetAttributeDestructively()
    (to set attribute values).
    sideshowbarker committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    a72d468 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c6fabf1 View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2023

  1. Make the SourceGitSHA-handling code for snapshots use CreateDestructi…

    …vely
    
    Currently the longest string we’re appending directly to Ropes is the
    40-character SourceGitSHA string for the snapshots, and the second-
    longest string is the 30-character “This section is non-normative.”.
    
    This change switches that SourceGitSHA-handling code to instead using
    Scratch.Append(@SourceGitSHA) and TText.CreateDestructively(Scratch) —
    so that we can reduce down to 30 the size of ShortStrings we allow to be
    appended directly to Ropes.
    sideshowbarker committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    ccf648d View commit details
    Browse the repository at this point in the history
  2. Limit appending of ShortStrings to Ropes to string length < 30

    The larger the size of ShortStrings we allow to be appended directly to
    Ropes, the more memory Wattsi consumes at runtime.
    
    We don’t need the size to be anywhere near as big as 255 — the existing
    code never actually needs to directly append strings with lengths any
    longer than 30. If we ever do run into need to append string lengths
    longer than 30, we could at that time just bump UTF8InlineSize up to
    whatever new size we actually need.
    
    Upping the size to 30 from the old size of 15 seems to increase the
    memory consumption by about 15–20%, or around 80–100MB. (In comparison,
    upping it to 255 seems to roughly double the memory consumption.)
    sideshowbarker committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    1ebe862 View commit details
    Browse the repository at this point in the history