Skip to content

Conversation

@cuihantao
Copy link
Contributor

@cuihantao cuihantao commented Oct 31, 2025

This PR adds comprehensive precompilation support using PrecompileTools.jl to significantly reduce the time-to-first-execution when loading and using PowerFlowData.jl.

Changes

  • Added PrecompileTools.jl as a dependency in Project.toml
  • Created src/precompile.jl with @setup_workload and @compile_workload macros
  • Precompilation workload parses all 6 test files covering:
    • Both v30 and v33 PSS/E format versions
    • Comma and space-delimited files
    • All data section types (buses, loads, generators, transformers, etc.)
    • Edge cases (quoted zero, space before zero)

Performance Impact

After this change, parsing operations are nearly instantaneous:

  • First parse after loading: ~0.0005 seconds (no compilation needed)
  • Tables.jl interface access: ~0.00003 seconds
  • Show operations: ~0.0003 seconds

The precompilation adds ~7-8 seconds to package installation time but eliminates all JIT compilation during first use, providing a much better user experience.

Testing

All 291 existing tests pass without modification.

PrettyTables.jl v3 API

This PR also updates the package to support PrettyTables.jl v3, which introduced breaking API changes. The show methods for Records types have been updated to use the new v3 API: headercolumn_labels, cropfit_table_in_display_horizontally/vertically, newline_at_endnew_line_at_end, vcrop_modevertical_crop_mode, and alignment_anchor_regex now accepts Vector{Regex} instead of Dict. The package now supports PrettyTables versions 3 only.

cuihantao and others added 3 commits October 26, 2025 16:51
- Added PrecompileTools dependency to Project.toml.
- Updated PowerFlowData.jl to include PrecompileTools and a new precompile.jl file.
- Implemented a comprehensive precompilation process for various test data files to enhance performance and ensure type coverage.
- Updated PrettyTables version in Project.toml to 3.
- Modified `Base.show` function in `types.jl` to accommodate v3 API changes, including renaming parameters and adjusting table display options.
- Updated test assertions in `runtests.jl` to reflect changes in table output formatting.
@cuihantao cuihantao changed the title Add PrecompileTools.jl to reduce time-to-first-execution Add PrecompileTools.jl to reduce time-to-first-execution; Update to PrettyTables.jl v3 API Oct 31, 2025
- Updated Julia version in Project.toml from 1 to 1.10.
- Modified CI workflow to use Julia 1.10 as the LTS version.
- Upgraded GitHub Actions versions for checkout, setup-julia, cache, and codecov to their latest stable releases.
@nickrobinson251 nickrobinson251 merged commit 4bf96ec into nickrobinson251:main Nov 18, 2025
3 checks passed
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