Skip to content

perf: implement append to avoid invalidating id2offset#94

Merged
hanxiao merged 2 commits intomainfrom
perf-no-invalidation-append
Feb 3, 2022
Merged

perf: implement append to avoid invalidating id2offset#94
hanxiao merged 2 commits intomainfrom
perf-no-invalidation-append

Conversation

@alaeddine-13
Copy link
Copy Markdown
Member

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 3, 2022

Codecov Report

Merging #94 (3a15c8c) into main (bd343d8) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
+ Coverage   85.24%   85.26%   +0.01%     
==========================================
  Files          98       98              
  Lines        4386     4390       +4     
==========================================
+ Hits         3739     3743       +4     
  Misses        647      647              
Flag Coverage Δ
docarray 85.26% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
docarray/array/storage/memory/seqlike.py 100.00% <100.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 bd343d8...3a15c8c. Read the comment docs.

@alaeddine-13 alaeddine-13 requested a review from hanxiao February 3, 2022 15:58
Comment on lines +20 to +27
def append(self, value: 'Document'):
"""Append `doc` to the end of the array.

:param value: The doc needs to be appended.
"""
self._data.append(value)
if not self._needs_id2offset_rebuild:
self._id_to_index[value.id] = len(self) - 1
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.

can you implement faster extend as well?

@hanxiao hanxiao merged commit 4c05919 into main Feb 3, 2022
@hanxiao hanxiao deleted the perf-no-invalidation-append branch February 3, 2022 18:09
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.

2 participants