Skip to content

[data] Chunk improvements#962

Merged
fwbrasil merged 3 commits into
getkyo:mainfrom
hearnadam:chunk-improvements
Jan 3, 2025
Merged

[data] Chunk improvements#962
fwbrasil merged 3 commits into
getkyo:mainfrom
hearnadam:chunk-improvements

Conversation

@hearnadam
Copy link
Copy Markdown
Collaborator

  • Extend StrictOptimizedSeqOps with Chunk to optimize Seq based methods
  • Improve APIs to correctly return Chunk[A] instead of Seq[A]
  • Optimize Chunk.Indexed#iterator
  • Optimize Chunk#take to avoid allocations
  • Optimize Chunk#appended to use Chunk#append

- Extend `StrictOptimizedSeqOps` with `Chunk` to optimize `Seq` based methods
- Improve APIs to correctly return `Chunk[A]` instead of `Seq[A]`
- Optimize `Chunk.Indexed#iterator`
- Optimize `Chunk#take` to avoid allocations
- Optimize `Chunk#appended` to use `Chunk#append`
"converts a Chunk to an IndexedSeq" in {
val chunk = Chunk(1, 2, 3, 4, 5)
assert(chunk.toSeq == Chunk(1, 2, 3, 4, 5))
assert(chunk == IndexedSeq(1, 2, 3, 4, 5))
Copy link
Copy Markdown
Collaborator

@johnhungerford johnhungerford Jan 1, 2025

Choose a reason for hiding this comment

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

Shouldn't this still be chunk.toSeq == ...?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The test is slightly incorrect to begin with. toSeq is now a noop given Chunk extends Seq.

I can remove the test.

@fwbrasil fwbrasil merged commit b27536f into getkyo:main Jan 3, 2025
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.

3 participants