Skip to content

feat(tidy3d): FXC-5311-enable-cached-loading-from-batch-data#3234

Merged
marcorudolphflex merged 1 commit intodevelopfrom
FXC-5311-enable-cached-loading-from-batch-data
Feb 6, 2026
Merged

feat(tidy3d): FXC-5311-enable-cached-loading-from-batch-data#3234
marcorudolphflex merged 1 commit intodevelopfrom
FXC-5311-enable-cached-loading-from-batch-data

Conversation

@marcorudolphflex
Copy link
Contributor

@marcorudolphflex marcorudolphflex commented Feb 4, 2026

What changed

  • Added in-memory caching for BatchData access when results are already downloaded and the total size of all batch data files stays under a configurable threshold.
  • Introduced config.batch_data_cache.max_total_size_gb (with enabled) to control this behavior.
  • Updated docs and changelog to document the new configuration.
  • Added tests for cache-hit and cache-miss behavior based on total batch size.

Why

  • Avoids repeated web.load calls when users iterate or index batch results multiple times, while preventing large batches from staying in memory.

Note

Medium Risk
Changes data-loading behavior in BatchData and adds stateful caching, which could impact memory usage and freshness if edge cases aren’t covered; guarded by a size threshold and explicit config flags.

Overview
Speeds up repeated access to td.web.BatchData results by optionally caching loaded task data objects in memory when the batch’s local result files are already present and their combined size is below a configurable threshold.

Introduces a new config section config.batch_data_cache (with enabled and max_total_size_gb) and wires BatchData.load_sim_data() / __getitem__ to reuse cached objects when eligible, while explicitly disabling the behavior for WASM builds and for large/non-downloaded batches. Documentation, changelog, and new unit tests cover cache-hit vs cache-miss behavior based on total file size.

Written by Cursor Bugbot for commit 4ad9e26. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@marcorudolphflex marcorudolphflex force-pushed the FXC-5311-enable-cached-loading-from-batch-data branch from 779e748 to b2a5769 Compare February 4, 2026 16:07
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Diff Coverage

Diff: origin/develop...HEAD, staged and unstaged changes

  • tidy3d/config/sections.py (100%)
  • tidy3d/web/api/container.py (87.5%): Missing lines 644,648-649,651,655

Summary

  • Total: 44 lines
  • Missing: 5 lines
  • Coverage: 88%

tidy3d/web/api/container.py

Lines 640-659

  640             return self._cache_enabled
  641 
  642         self._cache_enabled = False
  643         if WASM_BUILD:
! 644             return False
  645 
  646         try:
  647             cache_config = config.batch_data_cache
! 648         except AttributeError:
! 649             return False
  650         if not cache_config.enabled:
! 651             return False
  652 
  653         max_bytes = int(cache_config.max_total_size_gb * (1024**3))
  654         if max_bytes <= 0:
! 655             return False
  656 
  657         total_size = 0
  658         for task_path in self.task_paths.values():
  659             try:

@marcorudolphflex marcorudolphflex force-pushed the FXC-5311-enable-cached-loading-from-batch-data branch 2 times, most recently from e2e99f6 to 9b92ff8 Compare February 6, 2026 10:22
@marcorudolphflex marcorudolphflex force-pushed the FXC-5311-enable-cached-loading-from-batch-data branch from 9b92ff8 to 4ad9e26 Compare February 6, 2026 11:29
Copy link
Collaborator

@yaugenst-flex yaugenst-flex left a comment

Choose a reason for hiding this comment

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

Nice!

@marcorudolphflex marcorudolphflex added this pull request to the merge queue Feb 6, 2026
Merged via the queue into develop with commit db8dbc3 Feb 6, 2026
67 of 71 checks passed
@marcorudolphflex marcorudolphflex deleted the FXC-5311-enable-cached-loading-from-batch-data branch February 6, 2026 13:24
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.

2 participants