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

[data] Chunk improvements #962

Merged
merged 3 commits into from
Jan 3, 2025
Merged

Conversation

hearnadam
Copy link
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`
@@ -334,7 +334,7 @@ class ChunkTest extends Test:
"toSeq" - {
"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
Contributor

@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
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
3 checks passed
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