Reduce TTFX latency for common IMASdd operations by PrecompileTools #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive
@compile_workloadto significantly reduce TTFX (time to first execution) for common IMASdd operations. While this increases initial precompile (one-time cost) and load time (costs per session), it delivers dramatic improvements in runtime performance for frequently used functions.Performance Impact
One-Time (& per-session) Costs
using IMASdd)Runtime Performance Gains
hdf2imas()json2imas()imas2hdf()imas2json()deepcopy(dd)dd1==dd2Trade-off Analysis
Cost: +3 seconds per IMASdd loading
Benefit: Save 10~30 seconds on every file I/O operation
For typical workflows with I/O operations, the net time savings are substantial after the first operation.
Changes
src/precompile_workload.jlwith comprehensive workloadmktempdir()for safe temporary file cleanupdevnulloutput to avoid precompile clutterDeveloper Notes
Most developers/users rarely modify IMASdd, making the +100s precompile increase a true one-time installation cost. For active development, the workload can be disabled by
PrecompileTools.jlwithPreferences.jl