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

Avoid string allocations when generating object name #1453

Merged
merged 1 commit into from Sep 3, 2022
Merged

Avoid string allocations when generating object name #1453

merged 1 commit into from Sep 3, 2022

Conversation

ghost
Copy link

@ghost ghost commented Aug 18, 2022

Description

Hi, I am trying to optimize YARD a bit to speed up documentation runs on a large codebase.

The codebase is private, so I am using https://github.com/watir/watir/ as a smaller stand-in to report benchmarking numbers from https://github.com/SamSaffron/memory_profiler.

Test set-up

  • Ruby 2.7.6 (installed via rvm on Linux)
  • Watir version: 293bed2b57c
  • MemoryProfiler version: 1.0.0
  • YARD baseline: 0a55093
  • Test command:
    • ruby-memory-profiler --no-color --retained-strings=500 --allocated-strings=500 --max=300 -o prof.log ./run-yard.rb stats
      • run-yard.rb is a smaller version of /bin/yard (MemoryProfiler was not able to run /bin/yard)
      • I am using the stats command to avoid memory exhaustion

Performance data

  • Before
    • Total allocated: 187901758 bytes (1987572 objects)
    • Total retained: 4052113 bytes (53463 objects)
  • After
    • Total allocated: 187459865 bytes (1976523 objects)
    • Total retained: 4052153 bytes (53464 objects)
  • Savings
    • Total allocated: 441893 bytes (11049 objects)
    • Total retained: -40 bytes (-1 object)

Completed Tasks

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).

@lsegal lsegal merged commit 4fe39b6 into lsegal:main Sep 3, 2022
@lsegal
Copy link
Owner

lsegal commented Sep 3, 2022

Thanks for this improvement!

@ghost ghost deleted the perf/avoid-string-allocations branch September 12, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant