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

Stdin.readLineSync performance is very bad for large lines #45255

Open
mraleph opened this issue Mar 9, 2021 · 1 comment
Open

Stdin.readLineSync performance is very bad for large lines #45255

mraleph opened this issue Mar 9, 2021 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-io type-performance Issue relates to performance or code size

Comments

@mraleph
Copy link
Member

mraleph commented Mar 9, 2021

It reads input bytes one by one from the input and puts them into a growable list of <int>[].

This might lead to some very poor performance (compared to other languages) when reading exceedingly long lines from stdin.

@mraleph mraleph added area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-io type-performance Issue relates to performance or code size labels Mar 9, 2021
@aam
Copy link
Contributor

aam commented Mar 9, 2021

I guess the reason for this is that we don't want to read more bytes from the stream beyond end of the line which we ourselves identify as some form of a CR, LF sequence https://github.com/dart-lang/sdk/blob/master/sdk/lib/io/stdio.dart#L73 and below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-io type-performance Issue relates to performance or code size
Projects
None yet
Development

No branches or pull requests

2 participants