Skip to content

perf: use less memory for apply#312

Merged
hanxiao merged 2 commits intomainfrom
perf-apply-optimize-memory
Apr 30, 2022
Merged

perf: use less memory for apply#312
hanxiao merged 2 commits intomainfrom
perf-apply-optimize-memory

Conversation

@alaeddine-13
Copy link
Copy Markdown
Member

@alaeddine-13 alaeddine-13 commented Apr 29, 2022

Goals:

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 29, 2022

Codecov Report

Merging #312 (e3b4849) into main (da703b0) will decrease coverage by 2.01%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##             main     #312      +/-   ##
==========================================
- Coverage   86.29%   84.28%   -2.02%     
==========================================
  Files         134      134              
  Lines        6312     6306       -6     
==========================================
- Hits         5447     5315     -132     
- Misses        865      991     +126     
Flag Coverage Δ
docarray 84.28% <80.00%> (-2.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
docarray/array/mixins/parallel.py 66.66% <66.66%> (+2.77%) ⬆️
docarray/__init__.py 100.00% <100.00%> (ø)
docarray/array/storage/weaviate/find.py 89.74% <100.00%> (ø)
docarray/math/evaluation.py 0.00% <0.00%> (-82.15%) ⬇️
docarray/array/mixins/post.py 12.50% <0.00%> (-75.00%) ⬇️
docarray/array/mixins/evaluation.py 19.44% <0.00%> (-69.45%) ⬇️
docarray/helper.py 65.41% <0.00%> (-12.09%) ⬇️
docarray/document/mixins/sugar.py 40.00% <0.00%> (-12.00%) ⬇️
docarray/math/ndarray.py 88.00% <0.00%> (-2.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e2f70e...e3b4849. Read the comment docs.

new_da = DocumentArray(self.map(*args, **kwargs))
self.clear()
self.extend(new_da)
for doc in self.map(*args, **kwargs):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use batch_map would be efficient for some backends?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm, interesting thought, that could be true. especially when the afterward da[d.id] = d is IO bounded https://docarray.jina.ai/fundamentals/documentarray/parallelization/#use-map-batch-to-overlap-cpu-and-network-time

@alaeddine-13 you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

then it's better to use it for apply_batch not apply.
I have applied the same logic for apply_batch, can you check ?

@github-actions github-actions bot added size/s and removed size/xs labels Apr 29, 2022
@alaeddine-13 alaeddine-13 force-pushed the perf-apply-optimize-memory branch from d254861 to e3b4849 Compare April 29, 2022 13:40
@hanxiao hanxiao merged commit e2f478a into main Apr 30, 2022
@hanxiao hanxiao deleted the perf-apply-optimize-memory branch April 30, 2022 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify apply in order to use less memory

3 participants