Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ function unparameterize_type(T::Type)
end

# Workaround for slow dynamic dispatch for creating objects
const DEFAULT_PARSERCONTEXT = ParserContext{Dict{String, Any}, Int64, false, nothing}()
const DEFAULT_PARSERCONTEXT = ParserContext{Dict{String, Any}, Int64, true, nothing}()
Copy link
Member

Choose a reason for hiding this comment

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

If we change the default to be a non-strict spec, we will certainty want to update the docs and make a version bump. The Python docs may serve as a guide for communicating this: #280 (comment)

Copy link
Author

@Zentrik Zentrik Jan 4, 2024

Choose a reason for hiding this comment

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

Unless I'm missing something, this is a default in the sense that there is a fast path for it. This change doesn't change the result but is merely a performance improvement. If you look further down you'll see that these are the default parameters for parse.

function _get_parsercontext(dicttype, inttype, allownan, null)
if dicttype == Dict{String, Any} && inttype == Int64 && !allownan
if dicttype == Dict{String, Any} && inttype == Int64 && allownan && null === nothing
DEFAULT_PARSERCONTEXT
else
ParserContext{unparameterize_type(dicttype), inttype, allownan, null}.instance
Expand Down