-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node activity #425
Node activity #425
Conversation
|
yes |
core/src/create.jl
Outdated
@@ -22,11 +22,14 @@ end | |||
|
|||
function LinearResistance(db::DB, config::Config)::LinearResistance | |||
static = load_structvector(db, config, LinearResistanceStaticV1) | |||
return LinearResistance(static.node_id, static.resistance) | |||
active = coalesce.(static.active, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly that the 3 valid values for "active" are, true, false, and missing? Would it be easier to disallow missing and default to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that can be handled in the parse_static function of #424.
@@ -126,6 +126,7 @@ of Vectors or Arrow Primitives, and is added to avoid type instabilities. | |||
""" | |||
struct TabulatedRatingCurve{C} <: AbstractParameterNode | |||
node_id::Vector{Int} | |||
active::BitVector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we simply use Vector{Bool}
here? It uses more memory, but should be faster to read and write, since bits don't need to be shuffled around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was talking with Bart about this, the reason I suggested BitVector
is that he was using a function that returned a BitVector
, so no conversion step was necessary that way.
But if you think Vector{Bool}
is faster, we should probably switch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let's keep it the same. If it causes issues or shows up in profiling we can switch later.
Apparently the performance is not so clear cut: https://discourse.julialang.org/t/bitvector-vs-vector-bool-as-default-on-comparison-operations/49431
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Two things are still needed, some tests and not supporting missing active columns. But we can do that after #424 as you mention, or create a separate issue.
I'm not sure what precisely you mean by not supporting missing active columns, or is that now fixed? |
Fixes #98.
Here are some design decisions I came across: