
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
github.com/fedoseevalex/otusgolanghomework/hw10_program_optimization
Advanced tools
Вам дан исходный код функции GetDomainStat(r io.Reader, domain string), которая:
r пользовательские данные вида{"Id":1,"Name":"Howard Mendoza","Username":"0Oliver","Email":"aliquid_qui_ea@Browsedrive.gov","Phone":"6-866-899-36-79","Password":"InAQJvsq","Address":"Blackbird Place 25"}
{"Id":2,"Name":"Brian Olson","Username":"non_quia_id","Email":"FrancesEllis@Quinu.edu","Phone":"237-75-34","Password":"cmEPhX8","Address":"Butterfield Junction 74"}
{"Id":3,"Name":"Justin Oliver Jr. Sr.","Username":"oPerez","Email":"MelissaGutierrez@Twinte.gov","Phone":"106-05-18","Password":"f00GKr9i","Address":"Oak Valley Lane 19"}
(осторожно, в отличие от конкретной строки файл целиком не является валидным JSON);
domain.Например, для данных, представленных выше:
GetDomainStat(r, "com") // {}
GetDomainStat(r, "gov") // {"browsedrive": 1, "twinte": 1}
GetDomainStat(r, "edu") // {"quinu": 1}
Для большего понимания см. исходный код и тесты.
Необходимо оптимизировать программу таким образом, чтобы она проходила все тесты.
Нельзя:
GetDomainStat;Можно:
GetDomainStat);Обратите внимание на запуск TestGetDomainStat_Time_And_Memory
go test -v -count=1 -timeout=30s -tags bench .
Здесь используется билд-тэг bench, чтобы отделить обычные тесты от тестов производительности.
"Email" и пр. вместо ускорения анмаршалинга более поддерживаемыми и понятными средствами.FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.