Rewrite _preprocess for performance and customization (BREAKING) #55
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.
This PR fully rewrite the internal way
_preprocess
works, making it more performant and more customizable.This is also now split into two different function:
_process_with_names
: This is the new function to call for processing and accepts multiple arguments as specified below_preprocess
: This is the old function only expecting a single argument as input and doing transformation on it. By default, the generic fallback of_process_with_names
calls thisThe standard signature for a _process_with_names method is:
where
Val{true}
orVal{false}
and represents the flag to force number to be converted in Float32.AttrName
and represent the path of attributes names leading to this specific input. For example, if we are processing the input that is inside the xaxis_range in the layout, the functioncall will have this form:
_process_with_names(x, fl, AttrName(:xaxis), AttrName(:range), AttrName(:layout))
This again is to allow dispatch to work on the path so that one can customize behavior of _process_with_names with great control.
At the moment this is only used for modifying the behavior when
title
is passed as a String, changing it to the more recent plotly syntax (closing #51)As part of this PR we also removed the
skip_float32
function and renamed theScopedValue
toFORCE_FLOAT32
(which is now true by default).This is directly checked only in the method
_process_with_names(p::PlutoPlot)