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
Strip line info from default exprs #2932
Conversation
Compile Times benchmarkNote, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running: using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(display(fig))
|
@@ -94,7 +94,7 @@ macro Block(name::Symbol, body::Expr = Expr(:block)) | |||
esc(q) | |||
end | |||
|
|||
_defaultstring(x) = string(x) | |||
_defaultstring(x) = string(MacroTools.striplines(x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it work to do this without MacroTools, by just having:
striplines(@nospecialize(expr)) = expr
function striplines(expr::Expr)
args = [striplines(elem) for elem in expr.args if !(elem isa LineNumberNode)]
return Expr(expr.head, args...)
end
For a simple test, this seems to work fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sure, was just to lazy to copy paste and thought MacroTools is always an indirect dep anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fair enough, maybe we want to use MacroTools for our macros more anyways!
Description
Fixes #2926