-
Notifications
You must be signed in to change notification settings - Fork 134
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
Task2 #96
base: master
Are you sure you want to change the base?
Task2 #96
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
*Какими ещё результами можете поделиться* | ||
String#split - тяжелый, Array#<< - эффективный, потоки хороши (как обычно), всегда смотри что оптимизруешь) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split не то чтобы тяжёлый, он просто создаёт объекты в нашем случае, на каждую строчку по штук 5, потом они удаляются GC
В принципе можно воспользосаться split with block, там изнутри блока можно записывать значения в заранее созданные 5 переменных и наверно избежать создания лишних объектов
Но создание этих объектов не критично. Для нас тут самое главное, что мы не накапливаем в памяти большого объёма данных, и GC может удалять ненужные объекты и стабильно держать потребление памяти на 40Мб при обработке сколь угодно большого файла
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Array << не то чтобы эффективный, скорее a = a + [b] дико не эффективно, я бы так поставил акцент
No description provided.