Data::...Chunked(3pm)

πŸ“¦
version 0.11 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Data::...Chunked β€” bestie, it's chunking time πŸ’–

okay so real quick, this is a page from the User Contributed Perl Documentation for the module Data::...Chunked(3pm) β€” yes the real name is Data::Stream::Bulk::Chunked, the header just abbreviates it because it's dramatic like that πŸ’…


✨ NAME ✨

Data::Stream::Bulk::Chunked β€” combine streams into larger chunks 🧚


🌸 VERSION 🌸

version 0.11 β€” little baby version number, still iconic tho


πŸŽ€ SYNOPSIS πŸŽ€

like, here's how you'd actually use it:

use Data::Stream::Bulk::Chunked;

Data::Stream::Bulk::Chunked->new(
    stream     => $s,
    chunk_size => 10000,
);

no cap, that's the whole vibe 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so this is a stream that wraps another existing stream so you get more items in a single block. lowkey genius.

why do you care?? because it simplifies your app code if your code does its own processing one block at a time, and processing bigger blocks is more efficient. it's giving ✨optimization✨ but make it cute. the way that bigger blocks just hit different πŸ“


πŸ‘‘ ATTRIBUTES πŸ‘‘

  • stream β€” the stream you wanna chunk. Required. like, you literally cannot skip this one bestie, it's mandatory πŸ”₯
  • chunk_size β€” the minimum number of items to return in a block. defaults to 1, which... does nothing πŸ™ˆ (one item per block = no chunking at all, it's just the stream being itself)

πŸ’œ METHODS πŸ’œ

  • get_more β€” see Data::Stream::Bulk::DoneFlag for the deets.

it returns at least chunk_size items. and bestie, listen β€” this is not guaranteed to return exactly chunk_size items. it just returns multiple full blocks from the backend. also, the final block returned may have less than chunk_size items. that's not a bug, that's just how the last block works πŸ’€


🌈 AUTHOR 🌈

Yuval Kogman <nothingmuch@woobling.org> β€” shoutout to the author, main character energy fr fr πŸ‘‘


This software is copyright (c) 2012 by Yuval Kogman.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. 🫢


πŸ’Œ and that's the whole page bestie!! this one came from perl v5.32.0, dated 2021-01-01, and it lives at Data::...Chunked(3pm) in the User Contributed Perl Documentation. go chunk some streams, you got this πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from