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

Task2 #96

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Task2 #96

wants to merge 8 commits into from

Conversation

Yorickov
Copy link

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


*Какими ещё результами можете поделиться*
String#split - тяжелый, Array#<< - эффективный, потоки хороши (как обычно), всегда смотри что оптимизруешь)
Copy link
Collaborator

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Мб при обработке сколь угодно большого файла

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array << не то чтобы эффективный, скорее a = a + [b] дико не эффективно, я бы так поставил акцент

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants