Commit d2baca0
[Repo Assist] Perf: cache FullName, BaseType and GetInterfaces in TargetTypeDefinition (#485)
🤖 *This is an automated PR from Repo Assist, an AI assistant for this
repository.*
## Summary
`TargetTypeDefinition.FullName`, `BaseType`, and `GetInterfaces()` each
compute their result from immutable input data
(`inp.Namespace`/`inp.Name`, `inp.Extends`, `inp.Implements`) but were
recomputed on every call — allocating new strings/arrays and re-running
type resolution each time.
For large type providers with many types (e.g. SwaggerProvider), where
the F# compiler queries these properties many times per type during
type-checking, this saves repeated allocations and type-resolution work.
### Changes
| Property | Before | After |
|---|---|---|
| `FullName` | String concatenation every call | Cached `lazy` —
computed once, same `string` returned thereafter |
| `BaseType` | `txILType` (type-resolution) every call | Cached `lazy` —
resolved once |
| `GetInterfaces()` | `Array.map txILType` (allocates new `Type[]`)
every call | Cached `lazy` — resolved and allocated once |
All three caches use F# `lazy` which defaults to
`LazyThreadSafetyMode.ExecutionAndPublication`, so concurrent
first-access from multiple F# compiler threads is safe.
This is complementary to PR #471 (which cached member-wrapper arrays)
and does not touch the thread-safety areas being addressed by PRs
#482/#483.
## Test Status
```
Passed! - Failed: 0, Passed: 117, Skipped: 0, Total: 117 (net8.0)
```
All 117 pre-existing tests pass. The `netstandard2.0` build target ran
OOM on the CI machine (infrastructure issue, not caused by this change —
the same issue affects master); the `net8.0` build and tests both pass
cleanly.
> Generated by [Repo
Assist](https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/runs/23367946628)
·
[◷](https://github.com/search?q=repo%3Afsprojects%2FFSharp.TypeProviders.SDK+%22gh-aw-workflow-id%3A+repo-assist%22&type=pullrequests)
>
> To install this [agentic
workflow](https://github.com/githubnext/agentics/tree/d1d884596e62351dd652ae78465885dd32f0dd7d/workflows/repo-assist.md),
run
> ```
> gh aw add
githubnext/agentics@d1d8845
> ```
<!-- gh-aw-agentic-workflow: Repo Assist, engine: copilot, id:
23367946628, workflow_id: repo-assist, run:
https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/runs/23367946628
-->
<!-- gh-aw-workflow-id: repo-assist -->
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent dffd529 commit d2baca0
1 file changed
Lines changed: 20 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7982 | 7982 | | |
7983 | 7983 | | |
7984 | 7984 | | |
| 7985 | + | |
| 7986 | + | |
| 7987 | + | |
| 7988 | + | |
| 7989 | + | |
| 7990 | + | |
| 7991 | + | |
| 7992 | + | |
| 7993 | + | |
| 7994 | + | |
| 7995 | + | |
| 7996 | + | |
| 7997 | + | |
| 7998 | + | |
| 7999 | + | |
| 8000 | + | |
| 8001 | + | |
7985 | 8002 | | |
7986 | 8003 | | |
7987 | 8004 | | |
7988 | 8005 | | |
7989 | 8006 | | |
7990 | 8007 | | |
7991 | 8008 | | |
7992 | | - | |
7993 | | - | |
7994 | | - | |
7995 | | - | |
7996 | | - | |
7997 | | - | |
7998 | | - | |
7999 | | - | |
| 8009 | + | |
8000 | 8010 | | |
8001 | 8011 | | |
8002 | | - | |
8003 | | - | |
| 8012 | + | |
| 8013 | + | |
8004 | 8014 | | |
8005 | 8015 | | |
8006 | 8016 | | |
| |||
0 commit comments