Skip to content

Commit

Permalink
Merge pull request #35 from aristotelesbr/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
aristotelesbr authored Jan 10, 2024
2 parents 010d96f + d28c0fd commit 4e30d68
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 69 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
/.covered.db
/external
/docs
.DS_Store
*.gem

File renamed without changes
File renamed without changes
File renamed without changes
41 changes: 30 additions & 11 deletions guides/performance/readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Performance

The **Lennarb** is very fast. The following benchmarks were performed on a MacBook Pro (Retina, 13-inch, Early 2013) with 2,7 GHz Intel Core i7 and 8 GB 1867 MHz DDR3. Based on [jeremyevans/r10k](https://github.com/jeremyevans/r10k) using the following [template build](static/r10k/build/lennarb.rb).
The **Lennarb** is very fast. The following benchmarks were performed on a MacBook Pro (Retina, 13-inch, Early 2013) with 2,7 GHz Intel Core i7 and 8 GB 1867 MHz DDR3. Based on [jeremyevans/r10k](https://github.com/jeremyevans/r10k) using the following. All tests are performed using the **Ruby 3.3.0**

All tests are performed using the **Ruby 3.3.0**

## Benchmark numbers
## Benchmark results

This document contains the benchmarks comparing **Lennarb** with other routers based on Rack. Metrics evaluated include Requests per Second, Initial memory usage and Startup time.

Expand Down Expand Up @@ -41,21 +39,42 @@ This table shows the initial memory usage in KB. Lower values indicate lower mem

This table shows the startup time in seconds. Lower values indicate faster startup times.


## Graphs

### Requests per second (RPS)
See the graphs in the `benchmarks` directory of the lennarb project.

## Steps to run the benchmarks

### 1. Install the router gem you want to test

```bash
$ gem install lennarb
$ gem install syro
$ gem install roda
```

### 2. Clone the jeremyevans/r10k repository

```bash
$ git clone https://github.com/jeremyevans/r10k
```

### 3. Create a new file in the `r10k` directory

![Benchmarks](../../static/rps.png)
In the `r10k` directory, create a new file called `lennarb.rb` into `builders` directory with the code below:

### Initial memory usage
```bash
$ touch r10k/builders/lennarb.rb
```

![Benchmarks](../../static/memory.png)
Put the code below into `lennarb.rb` file:

### Runtime startup

![Benchmarks](../../static/runtime_with_startup.png)
### 4. Run the benchmarks

```bash
$ bundle exec rake benchmarks R10K_APPS="lennarb syro roda"
```

## Conclusion

Expand Down
49 changes: 22 additions & 27 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,42 @@

Lennarb is a lightweight, fast, and modular web framework for Ruby based on Rack. The **Lennarb** supports Ruby (MRI) 3.0+

## Usage

To use Lennarb is very simple, just create a instance of `Lennarb` and use the methods `get`, `post`, `put`, `patch` etc..
**Basic Usage**

```rb
app = Lennarb.new
```ruby
require "lennarb"

app.get("/hello/:name") do |req, res|
name = req.params[:name]

res.html("Hello #{name}")
Lennarb.new do |router|
router.get("/hello/:name") do |req, res|
name = req.params[:name]
res.html("Hello, #{name}!")
end
end
```

To more examples of usage see [getting started](https://aristotelesbr.github.io/lennarbguides/getting-started/index) documentation.

## Performance

### Requests per second (RPS) - Dinamic routes
### 1. Requests per Second (RPS)

![Benchmarks](static/rps.png)
| Position | Application | 10 RPS | 100 RPS | 1.000 RPS | 10.000 RPS |
| -------- | ----------- | ---------- | ---------- | --------- | ---------- |
| 1 | Lenna | 126.252,36 | 108.086,55 | 87.111,91 | 68.460,64 |
| 2 | Roda | 123.360,37 | 88.380,56 | 66.990,77 | 48.108,29 |
| 3 | Syro | 114.105,38 | 80.909,39 | 61.415,86 | 46.639,81 |
| 4 | Hanami-API | 68.089,18 | 52.851,88 | 40.801,78 | 27.996,00 |

To more details about the benchmarks, please see the [project documentation](https://aristotelesbr.github.io/lennarb/performance/index).
This table ranks the routers by the number of requests they can process per second. Higher numbers indicate better performance.

## Documentation
Plese see [Performance](https://gh.neting.cc.br/guides/performance/index) for more information.

Please see the [project documentation](https://aristotelesbr.github.io/lennarb) for more details.

- [Getting Started](https://aristotelesbr.github.io/lennarbguides/getting-started/index) - This guide show you how to use the `lennarb`

- [Response](https://aristotelesbr.github.io/lennarbguides/response/index) - This guide show you how to use the Response object
## Usage

## Contributing
- [Getting Started](https://gh.neting.cc.br/guides/getting-started/index) - This guide covers getting up and running with **Lennarb**.

We welcome contributions to this project.
- [Performance](https://gh.neting.cc.br/guides/performance/index) - The **Lennarb** is very fast. The following benchmarks were performed on a MacBook Pro (Retina, 13-inch, Early 2013) with 2,7 GHz Intel Core i7 and 8 GB 1867 MHz DDR3. Based on [jeremyevans/r10k](https://github.com/jeremyevans/r10k) using the following [template build](static/r10k/build/lennarb.rb).

1. Fork it.
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin my-new-feature`).
5. Create new Pull Request.
- [Response](https://gh.neting.cc.br/guides/response/index) - This is the response guide.
The `res` object is used to send a response to the client. The Lennarb use a custom response object to send responses to the client. The `res` object is an instance of `Lennarb::Response`.

### Developer Certificate of Origin

Expand Down
31 changes: 0 additions & 31 deletions static/r10k/build/lennarb.rb

This file was deleted.

0 comments on commit 4e30d68

Please sign in to comment.