-
Notifications
You must be signed in to change notification settings - Fork 16
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
add materialization counter #333
base: count-tags
Are you sure you want to change the base?
Conversation
@@ -426,3 +429,27 @@ def get_num_tags_of_type( | |||
return tcm(outputs) | |||
|
|||
# }}} | |||
|
|||
|
|||
def get_num_materialized(outputs: Union[Array, DictOfNamedArrays]) \ |
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.
def get_num_materialized(outputs: Union[Array, DictOfNamedArrays]) \ | |
def get_num_materialized_predecessors(outputs: Union[Array, DictOfNamedArrays]) \ |
|
||
def is_materialized(expr: ArrayOrNames) -> bool: | ||
if (isinstance(expr, Array) and | ||
any(isinstance(tag, ImplStored) for tag in expr.tags)): |
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.
any(isinstance(tag, ImplStored) for tag in expr.tags)): | |
expr.tags_of_type(ImplStored)): |
@@ -426,3 +429,27 @@ def get_num_tags_of_type( | |||
return tcm(outputs) | |||
|
|||
# }}} | |||
|
|||
|
|||
def get_num_materialized(outputs: Union[Array, DictOfNamedArrays]) \ |
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.
My main issue with this approach is that it has at least quadratic complexity. A possible improvement would be a CombineMapper
that simply counts the materialized predecessors for each node. I.e. combine
is a sum, and each node returns 1
if it's materialized and uses inherited behavior (reduce ("combine") over predecessors).
No description provided.