Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
When counting lines in Ruby randomly failed deployments | Better HN
When counting lines in Ruby randomly failed deployments
(opens in new tab)
(serpapi.com)
2 points
ilyazub
2y ago
2 comments
Share
2 comments
default
newest
oldest
ilyazub
OP
2y ago
Thanks to `@Freaky` from Reddit for the wonderful feedback which led him to significantly improving `String#count` which be potentially included to Ruby:
https://www.reddit.com/r/ruby/comments/16d4ha6/comment/k1f5m...
ilyazub
OP
2y ago
tl;dr: str.count($\) was 1.5x faster compared to str.lines.count and didn't allocate additional memory.
j
/
k
navigate · click thread line to collapse