-
Notifications
You must be signed in to change notification settings - Fork 632
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
Clean up bytes
module
#3549
Comments
I use |
@lino-levan Could you share your use cases? |
I use it a lot for efficient encoding. It doesn't look super used in the ecosystem outside of some of my repos and iuioiua's r2d2, but maybe that's just due to it's nature. I'm for keeping this around. |
I only use Benchmark: import { BytesList } from "https://deno.land/std@0.200.0/bytes/bytes_list.ts";
import { concat } from "https://deno.land/std@0.200.0/bytes/concat.ts";
const ARRAYS_LENGTH = 100;
const DATA_LENGTH = 100;
function genData(length: number) {
const data = new Uint8Array(length);
crypto.getRandomValues(data);
return data;
}
const arrays = Array.from(
{ length: ARRAYS_LENGTH },
() => genData(DATA_LENGTH),
);
Deno.bench("ByteList", { baseline: true }, () => {
const lines = new BytesList();
for (const array of arrays) lines.add(array);
lines.concat();
});
Deno.bench("concat", () => {
concat(...arrays);
}); Results:
I'm +1 for deprecating |
Heads up - this seems to have broken |
Most APIs of bytes module are simple functions that work on Uint8Arrays, but only
BytesList
has exceptional design and purpose.BytesList
was introduced for optimizingreadDelim
method ofio
(thenbufio
) module. #867 It was more like internal utility for optimization rather than a public API.I think we should deprecate this API before stabilizing
std/bytes
(but we might better to check the actual usages in the ecosystem)part of #3489
The text was updated successfully, but these errors were encountered: