Skip to content

Commit

Permalink
rename snoopiBenchBot ro snoopiBench
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 5, 2020
1 parent c964d1f commit be974c6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions docs/src/bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ Benchmarking the load infer time
```julia
println("loading infer benchmark")
@snoopiBenchBot "MatLang" using MatLang
@snoopiBench "MatLang" using MatLang
```

Benchmarking the example infer time
```julia
println("examples infer benchmark")
@snoopiBenchBot "MatLang" begin
@snoopiBench "MatLang" begin
using MatLang
examplePath = joinpath(dirname(dirname(pathof(MatLang))), "examples")
# include(joinpath(examplePath,"Language_Fundamentals", "usage_Entering_Commands.jl"))
Expand All @@ -145,7 +145,7 @@ end

Benchmarking the tests:
```julia
@snoopiBenchBot "MatLang"
@snoopiBench "MatLang"
```
[Ref](https://github.com/juliamatlab/MatLang/blob/master/deps/SnoopCompile/snoopBenchmark.jl)

Expand Down
4 changes: 2 additions & 2 deletions src/bot.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export precompile_activator, precompile_deactivator, precompile_pather, @snoopiBot, @snoopiBenchBot, BotConfig
export precompile_activator, precompile_deactivator, precompile_pather, @snoopiBot, @snoopiBench, BotConfig

const UStrings = Union{AbstractString,Regex,AbstractChar}
################################################################
Expand Down Expand Up @@ -27,4 +27,4 @@ end
include("bot/botutils.jl")
include("bot/precompileInclude.jl")
include("bot/snoopiBot.jl")
include("bot/snoopiBenchBot.jl")
include("bot/snoopiBench.jl")
24 changes: 12 additions & 12 deletions src/bot/snoopiBenchBot.jl → src/bot/snoopiBench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"""
timesum(snoop)
Calculates and prints the total time measured by a snoop macro. It is used inside @snoopiBenchBot.
Calculates and prints the total time measured by a snoop macro. It is used inside @snoopiBench.
Julia can cache inference results so to measure the effect of adding _precompile_() sentences generated by snoopi to your package, use the [`@snoopiBenchBot`](@ref). This benchmark measures inference time taken during loading and running of a package.
Julia can cache inference results so to measure the effect of adding _precompile_() sentences generated by snoopi to your package, use the [`@snoopiBench`](@ref). This benchmark measures inference time taken during loading and running of a package.
## Manually benchmarking withtout using [`@snoopiBenchBot`](@ref)
## Manually benchmarking withtout using [`@snoopiBench`](@ref)
- dev your package
- comment the precompile part of your package (`include()` and `_precompile_()`)
Expand Down Expand Up @@ -46,23 +46,23 @@ end

################################################################
"""
@snoopiBenchBot(packageName::String, snoopScript::Expr)
@snoopiBenchBot(packageName::String)
@snoopiBench(packageName::String, snoopScript::Expr)
@snoopiBench(packageName::String)
Performs an infertime benchmark by activating and deactivating the _precompile_()
# Examples
Benchmarking the load infer time
```julia
println("loading infer benchmark")
@snoopiBenchBot "MatLang" using MatLang
@snoopiBench "MatLang" using MatLang
```
Benchmarking the example infer time
```julia
println("examples infer benchmark")
@snoopiBenchBot "MatLang" begin
@snoopiBench "MatLang" begin
using MatLang
examplePath = joinpath(dirname(dirname(pathof(MatLang))), "examples")
# include(joinpath(examplePath,"Language_Fundamentals", "usage_Entering_Commands.jl"))
Expand All @@ -71,7 +71,7 @@ println("examples infer benchmark")
end
```
"""
macro snoopiBenchBot(packageName::String, snoopScript::Expr)
macro snoopiBench(packageName::String, snoopScript::Expr)

################################################################
packagePath = joinpath(pwd(),"src","$packageName.jl")
Expand Down Expand Up @@ -115,21 +115,21 @@ macro snoopiBenchBot(packageName::String, snoopScript::Expr)
end

"""
@snoopiBenchBot packageName::String
@snoopiBench packageName::String
Benchmarking the infer time of the tests:
```julia
@snoopiBenchBot "MatLang"
@snoopiBench "MatLang"
```
"""
macro snoopiBenchBot(packageName::String)
macro snoopiBench(packageName::String)
package = Symbol(packageName)
snoopScript = :(
using $(package);
runtestpath = joinpath(dirname(dirname(pathof($(package)))), "test", "runtests.jl");
include(runtestpath);
)
return quote
@snoopiBenchBot $packageName $(snoopScript)
@snoopiBench $packageName $(snoopScript)
end
end
4 changes: 2 additions & 2 deletions test/bot/bot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ cd(@__DIR__)
end
end
@testset "snoopiBenchBot" begin
@testset "snoopiBench" begin
using Pkg; Pkg.develop("MatLang")
examplePath = Base.read(`cmd /c julia -e 'import MatLang; print(pathof(MatLang))'`, String)
cd(dirname(dirname(examplePath)))
@snoopiBenchBot "MatLang" begin
@snoopiBench "MatLang" begin
using MatLang
examplePath = joinpath(dirname(dirname(pathof(MatLang))), "examples")
# include(joinpath(examplePath,"Language_Fundamentals", "usage_Entering_Commands.jl"))
Expand Down

0 comments on commit be974c6

Please sign in to comment.