-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a few allocation/inference issues (#885)
This was from an effort to play around with precompilation some more. There's a tricky balance where if we precompile too much of `CSV.File`, then we run into the Base bug where there are Base methods missing and cause painful allocations via invoke (JuliaLang/julia#35972). The state of precompilation for CSV.jl is thus pretty disappointing: precompiling currently takes ~7.5s (which is fine, this is the number we're fine to have keep growing), loading CSV.jl precompiled takes ~2.5s (seems a little high, but not terrible), but the first call to `CSV.File` takes ~6.5s :sad_face:. At this point, I've spent too much time and don't understand the ins and outs of precompilation interactions with later runtime code to debug further, but hopefully we can recruit help from some experts to take CSV.jl precompilation to the next level. As-is, it's workable, so let's go with this for now and get this darn release out.
- Loading branch information
Showing
4 changed files
with
65 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
const PRECOMPILE_DATA = "int,float,date,datetime,bool,null,str,catg,int_float\n1,3.14,2019-01-01,2019-01-01T01:02:03,true,,hey,abc,2\n2,NaN,2019-01-02,2019-01-03T01:02:03,false,,there,abc,3.14\n" | ||
function _precompile_() | ||
# ccall(:jl_generating_output, Cint, ()) == 1 || return nothing | ||
# CSV.File(IOBuffer(PRECOMPILE_DATA)) | ||
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing | ||
while false; end | ||
# CSV.Context(IOBuffer(CSV.PRECOMPILE_DATA)) | ||
# foreach(row -> row, CSV.Rows(IOBuffer(PRECOMPILE_DATA))) | ||
# CSV.File(joinpath(dirname(pathof(CSV)), "..", "test", "testfiles", "promotions.csv")) | ||
CSV.Context(joinpath(dirname(pathof(CSV)), "..", "test", "testfiles", "promotions.csv")) | ||
end |