Skip to content
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

Merged
merged 1 commit into from May 9, 2023

Conversation

jkrumbiegel
Copy link
Collaborator

Description

Fixes #2926

@MakieBot
Copy link
Collaborator

MakieBot commented May 8, 2023

Compile Times benchmark

Note, 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))
using create display create display
GLMakie 39.74s (39.39, 40.11) 0.26+- 18.18s (17.93, 18.68) 0.25+- 16.50s (16.21, 16.94) 0.25+- 11.84ms (11.54, 11.96) 0.14+- 138.66ms (135.02, 142.18) 2.86+-
master 39.68s (39.17, 40.10) 0.31+- 18.07s (17.85, 18.44) 0.21+- 16.54s (16.34, 16.85) 0.21+- 11.84ms (11.58, 12.11) 0.18+- 137.88ms (135.84, 138.72) 1.06+-
evaluation +0.14%, 0.06s invariant (0.19d, 0.72p, 0.29std) +0.58%, 0.11s invariant (0.45d, 0.41p, 0.23std) -0.26%, -0.04s invariant (-0.19d, 0.74p, 0.23std) +0.07%, 0.01ms invariant (0.05d, 0.93p, 0.16std) +0.56%, 0.78ms invariant (0.36d, 0.52p, 1.96std)
CairoMakie 33.50s (33.40, 33.56) 0.06+- 18.25s (18.08, 18.36) 0.10+- 2.68s (2.65, 2.73) 0.03+- 10.45ms (10.30, 10.62) 0.12+- 4.84ms (4.67, 4.99) 0.13+-
master 33.67s (33.56, 33.76) 0.09+- 18.28s (18.10, 18.42) 0.11+- 2.68s (2.65, 2.73) 0.02+- 10.50ms (10.34, 10.74) 0.13+- 5.07ms (4.89, 5.26) 0.14+-
evaluation -0.51%, -0.17s faster ✓ (-2.27d, 0.00p, 0.07std) -0.19%, -0.03s invariant (-0.31d, 0.57p, 0.11std) -0.06%, -0.0s invariant (-0.06d, 0.92p, 0.03std) -0.53%, -0.06ms invariant (-0.44d, 0.42p, 0.13std) -4.72%, -0.23ms faster ✓ (-1.73d, 0.01p, 0.13std)
WGLMakie 45.33s (44.82, 46.09) 0.42+- 22.47s (22.06, 22.76) 0.26+- 22.76s (22.28, 23.20) 0.33+- 14.25ms (13.84, 15.15) 0.52+- 802.19ms (760.73, 835.00) 21.90+-
master 45.02s (44.55, 45.28) 0.26+- 22.63s (22.29, 22.91) 0.24+- 22.93s (22.58, 23.29) 0.26+- 14.44ms (13.81, 15.29) 0.50+- 800.17ms (763.13, 819.63) 18.05+-
evaluation +0.69%, 0.31s invariant (0.90d, 0.12p, 0.34std) -0.71%, -0.16s invariant (-0.63d, 0.26p, 0.25std) -0.72%, -0.16s invariant (-0.54d, 0.33p, 0.30std) -1.32%, -0.19ms invariant (-0.37d, 0.51p, 0.51std) +0.25%, 2.01ms invariant (0.10d, 0.85p, 19.97std)

@@ -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))
Copy link
Member

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!

Copy link
Collaborator Author

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

Copy link
Member

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!

@SimonDanisch SimonDanisch merged commit dbf2d71 into master May 9, 2023
14 checks passed
@SimonDanisch SimonDanisch deleted the jk/strip-lines-attribute-defaults branch May 9, 2023 08:48
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.

@inherit calls include path in docstrings
3 participants