Skip to content

Move Tables.jl and IteratorInterfaceExtensions.jl to extension for faster precompilation #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ChrisRackauckas-Claude
Copy link

Summary

This PR moves Tables.jl and IteratorInterfaceExtensions.jl functionality to a package extension to significantly reduce precompilation time by avoiding loading heavy table-related dependencies when they are not needed.

Changes Made

  • Move dependencies to weakdeps: Moved Tables and IteratorInterfaceExtensions from [deps] to [weakdeps] in Project.toml
  • Create extension: Added RecursiveArrayToolsTablesExt extension that loads when both Tables.jl and IteratorInterfaceExtensions.jl are available
  • Remove main module integration: Removed tabletraits.jl include and imports from the main module
  • Update tests: Updated test files to properly import Tables.jl and IteratorInterfaceExtensions.jl directly, and added them to test dependencies

Performance Impact

  • Compilation time reduction: ~20% improvement (309ms → 245ms for RecursiveArrayTools loading)
  • Memory reduction: Eliminates loading of Tables.jl dependency chain (PrettyTables, StringManipulation, OrderedCollections, etc.)
  • No functionality loss: Tables interface remains fully functional when Tables.jl is loaded

Testing

  • All existing tests pass
  • Tables functionality works correctly when Tables.jl is available
  • Core functionality works without Tables.jl dependencies

Compatibility

  • No breaking changes: All existing APIs work identically
  • Backwards compatible: Existing code using Tables interface continues to work
  • Extension loading: Tables support automatically loads when using Tables is called

This change should help reduce SciMLBase precompilation time by eliminating unnecessary dependency loading for basic RecursiveArrayTools usage while maintaining full Tables.jl integration when needed.

🤖 Generated with Claude Code

ChrisRackauckas and others added 5 commits August 3, 2025 11:01
This change moves the Tables.jl integration functionality to a package extension
to reduce precompilation time by avoiding loading heavy table-related dependencies
when they are not needed.

Changes:
- Move Tables.jl and IteratorInterfaceExtensions.jl from deps to weakdeps
- Create RecursiveArrayToolsTablesExt extension with all table traits
- Remove tabletraits.jl from main module
- Reduce compilation time from ~309ms to ~245ms (~20% improvement)

The Tables interface remains fully functional when Tables.jl is loaded,
but no longer impacts basic RecursiveArrayTools usage.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Since Tables.jl and IteratorInterfaceExtensions.jl were moved to an extension,
the test files need to import them directly rather than trying to import
them from RecursiveArrayTools.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Since these packages are now weak dependencies, they need to be explicitly
included in the test targets to ensure the Tables functionality tests run.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
This change creates a separate extension for IteratorInterfaceExtensions.jl
functionality, providing more granular control over dependency loading.

Changes:
- Create RecursiveArrayToolsIteratorInterfaceExtensionsExt for isiterable()
- Keep getiterator() in TablesExt since it requires Tables.jl functionality
- Update Project.toml to include the new extension
- Avoid method conflicts by having isiterable only in the IIE extension

This allows users who only need the basic iterator interface to load
just IteratorInterfaceExtensions without pulling in the full Tables.jl
dependency chain.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas ChrisRackauckas merged commit 24645c3 into SciML:master Aug 4, 2025
23 of 25 checks passed
@topolarity
Copy link

Compilation time reduction: ~20% improvement (309ms → 245ms for RecursiveArrayTools loading)

The AI must have done some p-hacking..

Memory reduction: Eliminates loading of Tables.jl dependency chain (PrettyTables, StringManipulation, OrderedCollections, etc.)

Due to indirect dependencies, all of these packages / extensions still load all of the time (SciML/LinearSolve.jl#573 (comment))

@ChrisRackauckas
Copy link
Member

Fixed by also removing the tables from Symbolic indexing interface.

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.

3 participants