Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

perf(rome_js_formatter): Reduce FormatElement size #2456

Merged
merged 4 commits into from Apr 20, 2022

Commits on Apr 16, 2022

  1. perf(rome_js_formatter): Reduce FormatElement size

    This PR reduces the size of a `FormatElement` from 56 to 32 bytes by:
    
    * Using a `Box<str>` to store a dynamic token's string as it doesn't need to be mutable (safes 8 bytes for the `capacity`)
    * Only storing the start position for a `DynamicToken` because the length isn't used by the printer
    * Change the semantics of `verbatim_ranges` to store the ranges in the **formatted** string. The ranges in the formatted output should be sufficient for debugging and it allows to resolve the `String` rather than having to store it on the `FormatElement` (range can be computed in the printer).
    
    This improves the formatter's performance by about 10%
    MichaReiser committed Apr 16, 2022
    Configuration menu
    Copy the full SHA
    384026a View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2022

  1. wrap comment in {}

    MichaReiser committed Apr 19, 2022
    Configuration menu
    Copy the full SHA
    02fef69 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c26693e View commit details
    Browse the repository at this point in the history

Commits on Apr 20, 2022

  1. Configuration menu
    Copy the full SHA
    e3be30f View commit details
    Browse the repository at this point in the history