Repository navigation
Fickl performance experiments - #20
Draft
shayanhabibi wants to merge 29 commits into
Draft
shayanhabibi wants to merge 29 commits into
shayanhabibi wants to merge 29 commits into
Conversation
Fixed merge
Temporary fix, remove when upstream dotnet#13786 is fixed.
Fickle consumes FCS only from net10 processes, so the netstandard2.0 build is dropped and FCS can use modern runtime APIs directly. FSharp.DependencyManager.Nuget stays on netstandard2.0: it has overload ambiguities on net10 and is not on the compile path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodegenWitnessesForTyparInst built a fresh InfoReader (a dozen preallocated caches) on every call, before checking whether any type parameter carries a trait constraint. FSharpExprConvert.GetWitnessArgs calls it for every value and member application, so Fable's tests/Js/Main compile spent ~2 GB (18% of all allocation) on discarded InfoReaders. Return no witnesses early instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first check of a project goes through the graph-based checker, like fsc. Each file is checked with its own diagnostics logger, and the state after each file is rebuilt in file order so the check cache holds the same entries a sequential check would leave. Watch-mode rechecks stay sequential from the last unchanged file. The subscriber still gets files in project order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FSharpType caches whether it is resolved and its generic arguments, and checks resolution and abbreviation directly on the type definition reference instead of building an FSharpEntity per query. FSharpMemberOrFunctionOrValue caches its curried parameter groups. Compiling Fable's JS tests allocates 7.9 GB instead of 9.3 GB, with identical output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every check of several files now goes through the graph-based checker. Each file's result is kept, and reused while the file and everything it depends on, in the current or the previous dependency graph, are unchanged. After an edit only the edited file and its dependents are checked again, in parallel. CheckMultipleInputsUsingGraphModeWithStates takes the dependency graph from the caller, which needs it to decide what to reuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CheckIWSAM runs for every interface type named in a signature and looked up all methods in scope, extension methods included, only to discard extension members. Collecting extension methods was a third of the check time of large binding files: Glutinum's 18.7k-line TypeScript.fs checks in 1.9 s instead of 3.2-3.5 s. Warning 3536 is reported for the same types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fickl checks cached package sources as assemblies of their own, which a
compile of the project would check in its own assembly. Anonymous record
types belong to their assembly, so the project's {| ... |} no longer
type-checked against a cached API taking one, and an overload taking one
could silently lose to another. InteractiveChecker.SetAnonRecdTypesUnifiedAssembly
names the assemblies whose anonymous record types are one; none by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file checked again after an edit is compared with its earlier check by a fingerprint of its signature: types with type parameters numbered by position, constraints, attributes and their arguments, literal values, inline flags, argument names, accessibility, members, slots, union cases, fields and exceptions, leaving out ranges and stamps. When it is the same, the file's earlier finisher stays in the state its dependents are checked in, so they keep consistent entity identities and are reused; only the new implementation is reported. Anything the fingerprint cannot describe makes the file count as changed. FICKL_FCS_SIGNATURE_CUTOFF=0 turns it off. Each result now records the generation of the finisher of every file it depends on. Before, a file replaced in one check of part of the project let its dependents be reused against its old result in a later check of the rest, giving stale diagnostics and output. FICKL_FCS_GRAPH_LOG prints how many files each check reused, kept and replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for sharing the result of your investigation. Reading through the PR, it seems like we found some similar improvements.
I opened 2 mores PRs against
I think there is more improvement available this PR, but we still need to extract them and see where we can contribute them. |
Brings in 950 upstream commits (2025-11-21 to 2026-10-23), including the type checker allocation and caching work. Fork patches carried across: - Parameter attributes travel with ParamData; they are now WellKnownValAttribs, as ArgReprInfo.Attribs became upstream, and the new overload-resolution rules and delegate checks take only the ParamData. - Anonymous record CCU unification moved into TypedTreeOps.Remap.fs after upstream split TypedTreeOps.fs. - The FS1113 inline-accessibility check that replaced CheckInlineValueIsComplete is skipped under FABLE_CLI, as the old check was, so precompiled packages may inline internal values. - Witness generation keeps failing soft in quotations and the symbol API, around upstream's new CodegenWitnessesForTyparInstWith; the skip for type parameters without trait constraints is kept. - IWSAM checks skip extension members as upstream now does. - service_slim follows PartialResult's new own-signature field, the eighth TTrait field and the TypeCheckInfo constructor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream now lowers every string-typed interpolated string to String.Concat (dotnet#19971). Fable builds string templates (JSX, emitJs* templates, its own hole formatting) from the PrintfFormat an interpolated string used to produce, so under FABLE_CLI the earlier lowering is kept: String.Concat only when every hole is a string with no format, otherwise sprintf of a captured PrintfFormat. The parser now moves a hole's printf specifier and .NET alignment/format onto SynInterpolationFormatting, so the old checks read it from there. sprintf_info and mkCall_sprintf, removed upstream, are restored for this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream now reports FS1113 from post-inference checks as well as the optimizer. Fable lets inline functions use internal values (precompiled packages rely on it) and reports inlined private values itself, so under FABLE_CLI the check is skipped, as the optimizer's is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PropertyCollector enumerates a ConcurrentDictionary whose keys hash the property name, and string hashes are randomized per process, so the order of a type's properties changed from one run to the next. Fable picks and prints interface members in that order, so its output did too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The occurrence counters behind compiler-generated names, such as those of let rec values that are not all functions and of top-level patterns, live as long as the checker. In watch mode a file checked again kept counting from its last check, so recursive1@385 became recursive1@385-2, then -4, and the output differed from a fresh compilation. Fable's checker now resets the counters of a file, and only that file, before checking it. Code generation's counters are left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codegen witnesses for an application with trait constraints built a new InfoReader per call; since the dotnet/fsharp merge each of its dozen MemoizationTables is a Cache that preallocates a ConcurrentDictionary. FSharpExprConvert now passes its SymbolEnv's InfoReader (CodegenWitnessesForTyparInstUsing); the codegen solver state stays fresh. entityIsUnresolved, isResolvedAndFSharp and ccuOfTyconRef matched |ERefLocal|ERefNonLocal|, allocating a Choice per call; they test IsLocalRef. FSharpType.GenericArguments no longer copies the fresh arrays of function and measure types. Fable's tests/Js/Main watch rebuild after a new value in a widely used file: 2.2 -> 1.35 s with the matching Fable fixes; cold output byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Staging full tree for cherrypicking
See fable-compiler/Fable#5135