10000 Utilize cache infra by maxg-square · Pull Request #587 · square/Blueprint · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@maxg-square
Copy link
Contributor

3/3 for caching changes.
Design doc: https://docs.google.com/document/d/1CLhFbzZGbEKgvZTUwLuGbFY-rfZNJVTi6f3PkoZT9qI/edit?usp=sharing

Adds support for caching AttributedLabel string normalization results.
Adds support for skipping calls to setNeedsViewHierarchyUpdate when Environment and Element value changes are equivalent.
Adds support for caching MeasureableStorage measurements.

* maxg/cache_1_equivalency:
  include other TestKeys
  Fix testkey
* maxg/cache_2_envcache:
  include other TestKeys
  Fix testkey
* maxg/cache_2_envcache:
  include other TestKeys
  Fix testkey
* maxg/cache_2_envcache:
  include other TestKeys
  Fix testkey
* maxg/cache_2_envcache:
  More tests
  Tests and fixes
* main:
  Bump macOS, Xcode, Swift, and Tuist versions. (#580)
  chore: release 6.1.0
  Fix AccessibilityContainer behaviour when it contains a UICollectionView or UITableView
  Ignoring slight keyboard overlaps in ScrollView (#575)
* maxg/cache_2_envcache:
  Tweak env tests
  More tests
* main:
  Bump macOS, Xcode, Swift, and Tuist versions. (#580)
  chore: release 6.1.0
  Fix AccessibilityContainer behaviour when it contains a UICollectionView or UITableView
  Ignoring slight keyboard overlaps in ScrollView (#575)
* maxg/cache_2_envcache:
  Existentials for Xcode 15
* maxg/cache_2_envcache:
  Enable logging for test.
  Tweak internal env api.
  Log guard
* maxg/cache_2_envcache:
  Release 6.3.0
  Assert in debug mode when large content viewer is not placed inside an interaction container
  Expose largeContentViewerInteraction on LargeContentViewer backing view via protocol
  Stopped installing xcodes in GitHub Actions file
  chore: Release 6.2.0
  Support accessibility large content viewer
  Squash
Copy link
Collaborator
@watt watt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase this on the maxg/cache_2_envcache branch? Looks like it's got some changes from the other 2 stacked PRs mixed in.

// Shortcut: If both environments were empty, nothing changed.
if oldValue.isEmpty && environment.isEmpty { return }
// Shortcut: If there are no changes to the environment, then, well, nothing changed.
if let layoutMode, layoutMode.options.skipUnneededSetNeedsViewHierarchyUpdates && oldValue.isEquivalent(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.layoutMode is just one customization point — you should probably use something like:

self.layoutMode ?? RenderContext.current?.layoutMode ?? environment.layoutMode

which I think will match the actual mode used during layout.

@maxg-square maxg-square changed the base branch from main to maxg/cache_2_envcache October 2, 2025 21:18
return measurer(proposal, environment)
}

let key = MeasurableSizeKey(path: node.path, max: proposal.maximum)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use proposal directly than maximum I think — the latter is a headache to deal with and something I'd like to deprecate

9E79
/// - parameter validationKey: If present, measureFunction will attempt to cache sizing based on the path of the node. validationKey will be evaluated to ensure that the result is valid.
/// - parameter measureFunction: How to measure the `ElementContent` in the given `SizeConstraint` and `Environment`.
public init(
validationKey: some ContextuallyEquivalent,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pitching name measureCachingKey over validationKey — as a consumer there's no "validation" aspect to it, it's used to cache measurements

//
// Created by Max Goedjen on 7/23/25.
//

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO?

Comment on lines -214 to -216
// Store bounding shapes in this cache to avoid costly recalculations
private var boundingShapeCache: [Link: Link.BoundingShape] = [:]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happened to the deleted stuff in this file? intentional change, or just a bad merge?


self.element = element
self.environment = environment
self.environment.cacheStorage = cacheStorage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't need to set this here, it'll be applied during makeEnvironment. self.environment is the "base"

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.

3E17

3 participants

0