Skip to content

Add timestamp optimization for global.json in dotnetup manifest #53395

@nagilson

Description

@nagilson

Context

PR #53290 introduces install specs that can be sourced from global.json. During garbage collection and update workflows, dotnetup re-reads global.json files to refresh the channel/version. Since global.json files are typically small and don't change frequently, we can optimize by storing a timestamp of the last-modified time in the manifest's install spec.

Proposal

Add a timestamp field to global.json-sourced install specs, e.g.:

{
  "component": "sdk",
  "versionOrChannel": "10.0.1xx",
  "installSource": "globalJson",
  "globalJsonPath": "/repo/global.json",
  "timestamp": "2025-04-15T14:30:22.1234567Z"
}

If the file's last-modified time matches the stored timestamp, skip re-reading the file contents — we already know the channel from the install spec. This avoids unnecessary I/O during GC and update passes.

Considerations

  • global.json files are quite small, so the perf gain may be marginal.
  • Need to decide whether File.GetLastWriteTimeUtc is sufficient or if we need content hashing.
  • This is a v2 / lower priority optimization with small cost.

Origin

PR #53290 review comment: #53290 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnetupWork items around the proposed `dotnetup` bootstrapper/toolchain management tool and library

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions