>>1
Depending how you interpret the parentheses on the scope of "as many times as possible", you are asking us to output sussman the exact 100% optimal number of times for a given CPU in one second, using ruby. Read: not possible.
Name:
Anonymous2009-04-26 14:24
19208 sussmans per second.
How do I run a script that sussmans and kill it after one second.
?
Name:
Anonymous2009-04-26 14:24
loop { Thread.new { loop { puts "Sussman" } } }
Name:
Anonymous2009-04-26 14:25
But that's impossible, since it takes more than one second to output text.
>>5
Sorry, I meant to add that it's impossible in Ruby.
Name:
Anonymous2009-04-26 14:33
>>4
I doubt this will help the performance at all. How fast the program can loop is not the bottle neck here, but how fast the output stream can be written to and flushed.
Name:
Anonymous2009-04-26 15:02
>>8
Indeed, Ruby is written in C which leaves how threaded writing to stdout should be handled to the implementation. Most implementations are thread safe on FILE* writing, so I presume they will just mutex the buffer, and infact you may even get worse performance.