Repository navigation
perf: speculative navigation warmup, RegExp species fuse, speed-mode dial - #445
Closed
shahriar0247 wants to merge 1 commit into
Closed
shahriar0247 wants to merge 1 commit into
shahriar0247 wants to merge 1 commit into
Conversation
…e dial Three independent performance changes built and benchmarked on top of firefox-main @ 133570141: - SpiderMonkey: skip RegExp @@species lookups in String.split/matchAll via a new OptimizeRegExpSpeciesFuse (mirrors CanOptimizeArraySpecies): intrinsic + CacheIR stub + Warp compile dependency. Fuse pops restore the generic SpeciesConstructor path. - Urlbar: speculativeConnect on keyboard selection ('select' reason), with privacy derived from the window when no query context exists. - Hover prefetch: dom.speculation_rules.hover_prefetch_all synthesizes a moderate-eagerness PrefetchCandidate for same-origin links when the document has no rule sets, reusing the existing SpeculationRules / PrefetchRecordParent activation path. Plus a browser.speed.mode pref-bundle dial (SpeedMode.sys.mjs) and HTTPS hover-preconnect / anchor DNS prefetch defaults. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
No Taskcluster jobs started for this pull requestThe |
Contributor
|
(Automated Close) Please do not file pull requests here, see https://firefox-source-docs.mozilla.org/contributing/how_to_submit_a_patch.html |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
A bundle of independently-verified performance changes from a full local performance investigation of Firefox on Windows (three-stage PGO + cross-module ThinLTO build, Speedometer 3 / JetStream 3 baselines, samply-symbolicated profiles). Each change is small, gated where aggressive, and uses existing in-tree machinery rather than new subsystems.
Changes
OptimizeRegExpSpeciesFuse+CanOptimizeRegExpSpeciesintrinsic, CacheIR stub (tryAttachCanOptimizeRegExpSpecies), and WarpCompilationDependency::Type::RegExpSpeciesString.prototype.split/matchAllrunSpeciesConstructoron every call even whenRegExp.prototype.constructor/@@speciesare untouched. The fuse lets self-hostedRegExpSplit/RegExpMatchAlland the IC skip the lookup, popping to the generic path on mutation. MirrorsCanOptimizeArraySpecies(motivated by bug 1956245).speculativeConnect(result, null, "select")on keyboard selection; nullable context falls back toPrivateBrowsingUtils.isWindowPrivate(this.browserWindow);"select"shares themousedownhttp/https handlingdom.speculation_rules.hover_prefetch_allpref: when the document has no rule sets, hover on a same-origin http(s) link synthesizes a moderate-eagernessPrefetchCandidatefed through the existingSpeculationRules/PrefetchRecordParentpathFindMatchingPrefetchRecord, so a click on a completed prefetch serves from the record's cache entry. Parent-side same-site/trustworthy checks still apply.browser.speed.modedial (0=Performance, 1=Balanced default, 2=Fortress) applied by newSpeedMode.sys.mjsat startup; applied prefs tracked inbrowser.speed.appliedso mode switches cleanly restorespeculative-parallel-limit, per-server persistent connections, DNS cache lifetime and enables speculation rules; Balanced is stock.network.predictor.enable-hover-on-ssl: true,dom.prefetch_dns_for_anchor_https_document: trueFiles
js/src/vm/{CommonPropertyNames.h, RealmFuses.{h,cpp}, Watchtower.cpp, RegExpObject.cpp, SelfHosting.cpp},js/src/builtin/RegExp.{h,cpp,js},js/src/jit/{CacheIR.cpp, CacheIRGenerator.h, CompilationDependencyTracker.h, InlinableNatives.{h,cpp}, WarpOracle.cpp, WarpCacheIRTranspiler.cpp}js/src/jit-test/tests/basic/testRegExpSpecies.js(new)browser/components/urlbar/UrlbarParentController.sys.mjsdom/base/SpeculationRules.{h,cpp},dom/events/EventStateManager.cpp,modules/libpref/init/StaticPrefList.yamlbrowser/components/speedmode/{SpeedMode.sys.mjs, moz.build}(new),browser/components/{BrowserGlue.sys.mjs, moz.build},browser/app/profile/firefox.jsMeasured results
RegExp.prototype[Symbol.split]microbench (fuse-active vs fuse-popped)RegExp.prototype[Symbol.matchAll]microbenchtestRegExpSpecies.jsnon262/RegExprunThe species-fuse Speedometer impact is expected <0.5% — it's a correctness-preserving micro-optimization; the perceived-speed gains are in the navigation-speculation changes.
Testing
testRegExpSpecies.jscovers fuse-pop onconstructor,@@species, and prototype mutation.test non262/RegExpsuite: PASS.SpeedMode.init()verified end-to-end on a live profile: mode 0 writes the bundle and records applied prefs; mode 1 writes{}.PrefetchRecordParent::Init,FindMatchingPrefetchRecord, activation inDocumentLoadListener) is the existing upstream machinery — this patch only synthesizes the candidate child-side.Risk / notes
hover_prefetch_alldefaults false; only activates when the pref is set (the speed-mode Performance bundle sets it).Authoring environment
Produced by Cognition Devin (CLI agent, SWE-2 Max) at the request of the repo owner: build a faster Firefox and upstream the transferable pieces. Benchmarks, profiling data and the per-change investigation live in the fork's
docs/directory.Lando: link
🚫 This pull request has 2 blockers.