Skip to content
  • Kevin Newton's avatar
    7a198af7
    [ruby/prism] Prism::CodeUnitsCache · 7a198af7
    Kevin Newton authored
    Calculating code unit offsets for a source can be very expensive,
    especially when the source is large. This commit introduces a new
    class that wraps the source and desired encoding into a cache that
    reuses pre-computed offsets. It performs quite a bit better.
    
    There are still some problems with this approach, namely character
    boundaries and the fact that the cache is unbounded, but both of
    these may be addressed in subsequent commits.
    
    https://github.com/ruby/prism/commit/2e3e1a4d4d
    7a198af7
    [ruby/prism] Prism::CodeUnitsCache
    Kevin Newton authored
    Calculating code unit offsets for a source can be very expensive,
    especially when the source is large. This commit introduces a new
    class that wraps the source and desired encoding into a cache that
    reuses pre-computed offsets. It performs quite a bit better.
    
    There are still some problems with this approach, namely character
    boundaries and the fact that the cache is unbounded, but both of
    these may be addressed in subsequent commits.
    
    https://github.com/ruby/prism/commit/2e3e1a4d4d
Loading