Improve performance by ~10%
Improve performance by ~10%

Reduces amount of object creation / memory allocation in some hot code paths.

Inspired by a blog post [1] on the 'allocation_stats' gem I looked into
yard's memory use (using the 'memory_profiler' gem) and found some hotspots
that the attached patch removes. It reduces memory allocations by ~25%,
while increasing performance by ~10%, measured on the test_doc Rake task of
Yard itself.

[1] https://blog.presidentbeef.com/blog/2018/11/28/finding-ruby-performance-hotspots-via-allocation-stats/

lsegal/yard,thomthom/yard,lsegal/yard,lsegal/yard,thomthom/yard,thomthom/yard