Sha256: 91f72903cbb490d1dbbe6c2c68ae21f0171122fcc0f76e80d5ce91c08736bf7d

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

# NYNY vs Sinatra performance test

Note: all the tests below were made using Thin as a webserver. Httperf was
choosen as the tool to do that. Bench settings: `--num-conns 10000`

Hardware: Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz, 6 GB DDR3

If you have a clue how to make proper benchmarks (because, frankly, I don't), I am open to suggestions.

## Results

| Benchmark | NYNY (req/s) | Sinatra (req/s) |
|-----------|:---------------:|:---------------:|
| Simple    |__5012__         |2534             |
| UrlPattern|__4564__         |2338             |
| Filters   |__4510__         |2465             |
| Helpers   |__4737__         |2663             |

See below the code for each benchmark

## Code
### Simple
```ruby
class App < NYNY::App #(or Sinatra::Base)
  get '/' do
    'Hello World!'
  end
end
```

### UrlPattern
```ruby
class App < NYNY::App #(or Sinatra::Base)
  get '/hello/:name' do
    "Hello #{params[:name]}!"
  end
end
```

### Filters
```ruby
class App < NYNY::App #(or Sinatra::Base)
  before do
    request
  end

  after do
    response
  end

  get '/' do
    'Hello World!'
  end
end
```

### Helpers
```ruby
module Dude
  def da_request_man
    request
  end
end

class App < NYNY::App #(or Sinatra::Base)
  helpers Dude

  get '/' do
    da_request_man
    'Hello World!'
  end
end
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nyny-2.0.0 Performance.md
nyny-1.0.2 Performance.md