2 ms·
Depends. If you do a naive Ruby implementation, then you'll be CPU-bound quite quickly. #!/usr/bin/env ruby while line = STDIN.gets puts line.split(/\
by fizx 17y ago
Depends. If you do a naive Ruby implementation, then you'll be CPU-bound quite quickly.
#!/usr/bin/env ruby
while line = STDIN.gets
puts line.split(/\s+/).first
end
This pegs my CPU at only 2MB/s, well below the IO capabilities of any modern system. I guess the tool you're using matters, which I think was the original point.