~/talk

fs2.Chunk

Talkat Scala Love 2022 · on Friday, 2022-02-18· [scala, frontend-architecture]
slides:none on file

Chunk is fs2’s immutable, strict sequence optimized for moving bytes around: multiple implementations (empty, singleton, array-backed slice, Java NIO view) to be memory-competitive with primitive arrays and avoid copies. Map uses an Array[Any] trick to avoid ClassTag in most APIs; concat struggled with specialization so a heuristic concat tagged plus a fallback was used (broke on Scala.js). Final solution adds a chunk-of-chunks with a lazily computed accumulated sizes index: first lookup is linear, subsequent lookups O(log m), worst case about n log n.

AI-written summary · about

  1. 0:00Introduction to fs2 Chunks
  2. 1:27History of the Chunk Type
  3. 3:29The fs2 IO API
  4. 5:54Memory Efficiency and Tuning
  5. 7:36Defining the Chunk Trait
  6. 9:39Implementing Chunk Types
  7. 11:26Structural Sharing
  8. 13:13Array Slices Implementation
  9. 15:21Mapping over Chunks
  10. 17:34Map Challenges
  11. 19:56The Map Implementation
  12. 22:27Filtering Chunks
  13. 23:50Concatenation Strategies
  14. 25:48Concat Implementation
  15. 27:39The Uncons Pull
  16. 30:24Tagless Concat Experiment
  17. 32:41ScalaJS Challenges
  18. 34:38Queue Implementation
  19. 37:20Optimizing Lookup
  20. 39:46For-Each Quadratic Issue
  21. 42:12Binary Search Optimization
  22. 45:41Conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.