timholy / SnoopCompile.jl

Provide insights about latency (TTFX) for Julia packages
https://timholy.github.io/SnoopCompile.jl/dev/
Other
309 stars 48 forks source link

Better handeling of user errors for SnoopCompile Bot #62

Closed aminya closed 4 years ago

aminya commented 4 years ago

Related to a couple of comments: https://github.com/timholy/SnoopCompile.jl/pull/49#discussion_r362444307 https://github.com/timholy/SnoopCompile.jl/pull/49#discussion_r362514505 https://github.com/timholy/SnoopCompile.jl/pull/49#discussion_r362442292

I am assuming that the users of this package are following the rules I set and specified in the documentation, and so the code works for these situations.

Handling all the other possibilities does not have much value.


For example:

To make the whole code independent of the current working directory and where packages files are placed a couple of things should be done. For example to get the path of the package we should do:

packagePath = Base.read(`cmd /c julia -e 'import MatLang; print(pathof(MatLang))'`, String)

instead of https://github.com/aminya/SnoopCompile.jl/blob/32d36d1e9a2bc3d22fa90afe3652e2f404689e5d/src/bot/snoopiBot.jl#L30

packagePath = joinpath(pwd(),"src","$packageName.jl")

or for precompile_$packageName.jl, some script can search in the package folder.


or if the user decides to have multiple precompile inclusion by mistake, such as:

# include("precompile.jl")
# _precompile_()

# some other stuff

include("precompile.jl")
_precompile_()

The code will not work.