Skip to content
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

Better treshold calculation for chunked output #5523

Merged
merged 3 commits into from Nov 16, 2023

Conversation

jenshnielsen
Copy link
Collaborator

@jenshnielsen jenshnielsen commented Nov 16, 2023

Rather than using sys.getsizeof which has a huge overhead when the row size is small.
E.g. a dataset with many small rows.

In [2]: import numpy as np
In [3]: d = np.array([[1,2,3],[4,5,6]])
In [4]: import sys
In [5]: sys.getsizeof(d)
Out[5]: 152
In [6]: d.dtype.itemsize * d.size
Out[6]: 24

Also add a test for exporting pure numeric datasets which was previously not covered.
And correct a warning from opentelemetry due to non str attributes on log messages

This gives a much more accurate estimate when we are dealing with
many small arrays that are merged into one.

For example:
For 6 elements array the overhead of sys.getsizeof
gives a size increase with a factor of 6

In [2]: import numpy as np
In [3]: d = np.array([[1,2,3],[4,5,6]])
In [4]: import sys
In [5]: sys.getsizeof(d)
Out[5]: 152
In [6]: d.dtype.itemsize * d.size
Out[6]: 24
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Merging #5523 (3123af7) into main (62b3498) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5523      +/-   ##
==========================================
- Coverage   66.32%   66.32%   -0.01%     
==========================================
  Files         354      354              
  Lines       30954    30953       -1     
==========================================
- Hits        20531    20530       -1     
  Misses      10423    10423              

@jenshnielsen jenshnielsen added this pull request to the merge queue Nov 16, 2023
Merged via the queue into microsoft:main with commit 136ee26 Nov 16, 2023
16 checks passed
@jenshnielsen jenshnielsen deleted the better_treshold branch November 16, 2023 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants