Skip to content

perf(UnionCaseArgInfo): Flatten Name / CommandLineNames / AppSettingsName#310

Open
dimension-zero wants to merge 1 commit into
fsprojects:masterfrom
dimension-zero:pr/22-flatten-remaining-lazy-fields
Open

perf(UnionCaseArgInfo): Flatten Name / CommandLineNames / AppSettingsName#310
dimension-zero wants to merge 1 commit into
fsprojects:masterfrom
dimension-zero:pr/22-flatten-remaining-lazy-fields

Conversation

@dimension-zero
Copy link
Copy Markdown
Contributor

perf(UnionCaseArgInfo): Flatten Name / CommandLineNames / AppSettingsName

Three more fields graduate from Lazy<_> to the strict value, matching
the pattern of pr/01-lazy-bool-flatten which did the same for the seven
bool-valued fields. These three are forced on every parse and every
help rendering, so the Lazy wrapper was pure overhead.

  • UnionArgInfo.fs: field types are now string, string list, string option.
    IsCommandLineArg reads the strict list directly.
    ToArgumentCaseInfo() wraps the strict values with 'lazy v' so the
    public ArgumentCaseInfo shape (Lazy<_>) is preserved verbatim.
  • PreCompute.fs: commandLineArgs, appSettingsName and defaultName are
    computed strictly at construction. The dependency between them is
    unchanged. The trailing checkStructure force-evaluations for these
    three fields are dropped (no lazy left to force).
  • Cli.fs / KeyValue.fs / Common.fs / UnParsers.fs / ParseResults.fs:
    drop .Value reads on the now-strict fields. Roughly 20 call sites.

All 112 tests pass unchanged. Public ArgumentCaseInfo unchanged.


…Name

Three more fields graduate from Lazy<_> to the strict value, matching
the pattern of pr/01-lazy-bool-flatten which did the same for the seven
bool-valued fields. These three are forced on every parse and every
help rendering, so the Lazy wrapper was pure overhead.

* UnionArgInfo.fs: field types are now string, string list, string option.
  IsCommandLineArg reads the strict list directly.
  ToArgumentCaseInfo() wraps the strict values with 'lazy v' so the
  public ArgumentCaseInfo shape (Lazy<_>) is preserved verbatim.
* PreCompute.fs: commandLineArgs, appSettingsName and defaultName are
  computed strictly at construction. The dependency between them is
  unchanged. The trailing checkStructure force-evaluations for these
  three fields are dropped (no lazy left to force).
* Cli.fs / KeyValue.fs / Common.fs / UnParsers.fs / ParseResults.fs:
  drop .Value reads on the now-strict fields. Roughly 20 call sites.

All 112 tests pass unchanged. Public ArgumentCaseInfo unchanged.
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