Skip to content

Commit

Permalink
Merge pull request #9 from co1emi11er2/precompile
Browse files Browse the repository at this point in the history
Precompile
  • Loading branch information
co1emi11er2 authored Apr 23, 2024
2 parents 51da367 + 64e0f34 commit 55c85b8
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.0"
manifest_format = "2.0"
project_hash = "0e345527edcf441c2de8a2d1c00b2b6466582291"
project_hash = "08e06d85f7dc0b46fe1a0e0a0c4f513f33230ac3"

[[deps.AbstractTrees]]
git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177"
Expand Down Expand Up @@ -145,6 +145,18 @@ deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.10.0"

[[deps.PrecompileTools]]
deps = ["Preferences"]
git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f"
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
version = "1.2.1"

[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.3"

[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Expand Down
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Handcalcs"
uuid = "e8a07092-c156-4455-ab8e-ed8bc81edefb"
authors = ["Cole Miller"]
version = "0.3.0"
version = "0.3.1"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -10,6 +10,7 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
TestHandcalcFunctions = "6ba57fb7-81df-4b24-8e8e-a3885b6fcae7"

Expand All @@ -19,6 +20,7 @@ CodeTracking = "1.3"
LaTeXStrings = "1.3"
Latexify = "0.16"
MacroTools = "0.5"
PrecompileTools = "1.2"
Revise = "3.5"
TestHandcalcFunctions = "0.2"
Unitful = "1.19"
Expand Down
2 changes: 2 additions & 0 deletions src/Handcalcs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ using LaTeXStrings
using CodeTracking, Revise
using InteractiveUtils
import AbstractTrees: Leaves
using PrecompileTools: @setup_workload, @compile_workload

export @handcalc, @handcalcs, @handfunc, multiline_latex, collect_exprs
export set_handcalcs, reset_handcalcs, get_handcalcs #, initialize_format
Expand All @@ -33,5 +34,6 @@ include("default_h_kwargs.jl")
include("handcalc_marco.jl")
include("handcalcs_macro.jl")
include("handfunc_macro.jl")
include("precompile.jl")

end
46 changes: 46 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@setup_workload begin
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
# precompile file and potentially make loading faster.
b = 5.0
h = 15.0
a = 1
xx = [1; 2; 3]
yy = [4; 5; 6]

@compile_workload begin

# Generic calc
@handcalcs begin
Iy = h*b^3/12; "moment of inertia y";
Ix = b*h^3/12; "moment of inertia x";
end

# parameters calcs
@handcalcs begin
a
bb = 2
cc = 3
x = 4
y = 5
z = 6
end cols=3 spa=5 h_env = "align"


calc = @handcalcs z = xx + yy

@handcalcs x = (-5.0 + sqrt(5.0^2 - 4*2*2))/(2*2)

# @handcalcs begin
# I_x = calc_Ix(5,15)
# end

# @handcalcs begin
# I_s = calc_Is(5,15)
# end

# @handcalcs begin
# I_s = calc_Is(5,15)
# end not_funcs = [calc_Ix calc_Iy]

end
end

2 comments on commit 55c85b8

@co1emi11er2
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

Added Feature

  • Added precompile step. TTFX should be a little quicker for some things.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/105411

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" 55c85b8bd7ab30b880124cd4f84cfc0ad9d4cc24
git push origin v0.3.1

Please sign in to comment.