You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bootsnap already caches $LOAD_PATH lookups (added in #17809), but the ISeq compile cache was left disabled. The ISeq cache compiles Ruby source files to bytecode on first load and serves the pre-compiled bytecode on subsequent boots, avoiding repeated parsing and compilation of ~500+ Ruby files during startup.
This was originally disabled with the comment "breaks coverage reporting" — but we don't do this in CI anymore, if we want to do it in the future it makes more sense to figure out how we should deal with this issue then rather than guess at the best way now when we aren't doing coverage
Verification Steps
Delete the existing bootsnap cache: rm -rf ~/.msf4/bootsnap_cache
Start msfconsole — first boot builds the cache (may be slightly slower)
Exit and start msfconsole again — second boot should be noticeably faster
Run hyperfine --warmup 3 "bundle exec ruby ./msfconsole -q -x 'exit'" should be improved from master
Test Evidence
# Before (compile_cache_iseq: false)
Benchmark 1: bundle exec ruby ./msfconsole -q -x 'exit'
Time (mean ± σ): 4.242 s ± 0.066 s [User: 3.024 s, System: 1.281 s]
Range (min … max): 4.135 s … 4.366 s 10 runs
# After (compile_cache_iseq: true)
Benchmark 1: bundle exec ruby ./msfconsole -q -x 'exit'
Time (mean ± σ): 3.941 s ± 0.069 s [User: 2.358 s, System: 1.404 s]
Range (min … max): 3.849 s … 4.083 s 10 runs
Environment
Field
Details
Operating System
macOS (26.5.2)
Target Software/Hardware
Metasploit Framework (Ruby 3.3.8)
AI Usage Disclosure
Kiro
Pre-Submission Checklist
No sensitive information (IP addresses, credentials, API keys, hashes) in code or documentation
Tested on the target environment specified in the Environment section above
I think it'd be worth a cycle just double checking what the bootsnap dir looks like after these changes, and if there'll be any issues for pro/console users. I think it should auto-update transparently, but it'd be worth sanity checking things here 👀
Also worth double checking that the folder won't indefinitely grow over time after changes are made in each release etc, as we don't have any logic to clean this up
I think it'd be worth a cycle just double checking what the bootsnap dir looks like after these changes, and if there'll be any issues for pro/console users. I think it should auto-update transparently, but it'd be worth sanity checking things here 👀
Also worth double checking that the folder won't indefinitely grow over time after changes are made in each release etc, as we don't have any logic to clean this up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Enable bootsnap's ISeq compile cache (
compile_cache_iseq: true) to improvemsfconsolestartup time.Bootsnap already caches
$LOAD_PATHlookups (added in #17809), but the ISeq compile cache was left disabled. The ISeq cache compiles Ruby source files to bytecode on first load and serves the pre-compiled bytecode on subsequent boots, avoiding repeated parsing and compilation of ~500+ Ruby files during startup.This was originally disabled with the comment "breaks coverage reporting" — but we don't do this in CI anymore, if we want to do it in the future it makes more sense to figure out how we should deal with this issue then rather than guess at the best way now when we aren't doing coverage
Verification Steps
rm -rf ~/.msf4/bootsnap_cachemsfconsole— first boot builds the cache (may be slightly slower)msfconsoleagain — second boot should be noticeably fasterhyperfine --warmup 3 "bundle exec ruby ./msfconsole -q -x 'exit'"should be improved from masterTest Evidence
Environment
AI Usage Disclosure
Kiro
Pre-Submission Checklist