-
Notifications
You must be signed in to change notification settings - Fork 12
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
Optimization of some functions #462
Conversation
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.
@@ -345,3 +357,76 @@ def test_msdf_from_mappings(self): | |||
self.assertEqual(1, len(new_msdf.df.index)) | |||
self.assertEqual(rows[0], tuple(msdf.df.iloc[0])) | |||
self.assertEqual(new_msdf.metadata, msdf.metadata) | |||
|
|||
def test_get_dict_from_mapping(self): |
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.
this tests many many different things - it's not helpful if we ever need to debug or understand what happened. Instead, it's preferable to make many small, minimal tests for each part of the function that's being tested
src/sssom/util.py
Outdated
# join all the values into a string separated by '|' | ||
map_dict[property] = "|".join(enum_value for enum_value in mapping_property) | ||
elif is_enum: | ||
# FIXME needs test |
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.
needs test
src/sssom/util.py
Outdated
if isinstance(mapping_property, list): | ||
# If the property is an enumeration and it allows multiple values | ||
if is_enum and slot_of_interest["multivalued"]: | ||
# FIXME needs test |
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.
needs test
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.
Great, and the performance gains are phenomenal! Thank you @hrshdhgd!
I glanced through quickly and couldn't figure out how things are running faster, but glad to hear it! |
Addresses #202
poetry update
_get_sssom_schema_object()
once in the functionget_dict_from_mapping()
rather than multiple times in a for loop that is inefficient.pandas.iterrows()
usepandas.apply()
in_get_mapping_set_from_df()
SchemaView
object instantiation and persistence@cached_property
thank you @cthoyt