Created
          September 7, 2009 02:52 
        
      - 
      
- 
        Save deobald/182115 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class ThreadTest < Test::Unit::TestCase | |
| # ~ 340 microseconds per thread spin-up, regardless of `-J-Djruby.thread.pooling=[true|false]' | |
| def test_some_speeds | |
| @runs = 0 | |
| def func | |
| @runs += 1 | |
| end | |
| Benchmark.bm do |bm| | |
| bm.report do | |
| 100000.times do | |
| t = Thread.new{ func() } | |
| t.join | |
| end | |
| end | |
| end | |
| puts @runs | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment