A simple VS. between Sinatra and Martini

Sinatra VS. Martini

There are already many comparison data available online, but nothing is as reliable as doing it yourself. So, I set up two “Hello World” applications, one using Sinatra and the other using Martini, on a VPS. I used Siege, a testing tool for Linux, to compare their performance.

Performance

Sinatra

1
siege -q -c 1000 -r 30 -f sinatra.url
1
2
3
4
5
6
7
8
9
10
11
12
Transactions: 29332 hits
Availability: 97.77 %
Elapsed time: 107.10 secs
Data transferred: 0.38 MB
Response time: 1.73 secs
Transaction rate: 273.87 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 473.90
Successful transactions: 29332
Failed transactions: 668
Longest transaction: 25.45
Shortest transaction: 0.00

Martini

1
siege -q -c 1000 -r 30 -f martini.url
1
2
3
4
5
6
7
8
9
10
11
12
Transactions: 29988 hits
Availability: 99.96 %
Elapsed time: 58.56 secs
Data transferred: 0.34 MB
Response time: 0.46 secs
Transaction rate: 512.09 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 235.70
Successful transactions: 29988
Failed transactions: 12
Longest transaction: 31.10
Shortest transaction: 0.00

Code Amount

Of course, when developing, it is not only about focusing on server performance. “Peopleware” has long emphasized that, compared to machines, the speed of programmers should be given the highest priority.

As it is only a simple “hello world” print, it is not possible to make a further detailed comparison of the amount of code (feel free to leave comments).

Most of Go’s libraries are downloaded from GitHub. Is the code quality guaranteed? On the other hand, Ruby is already quite mature (it seems like a few years ago when Python was compared to Ruby).

Conclusion

So, if the daily page views are below tens of millions, Ruby is absolutely fine.

Also, in the book “Programmer’s World” by Yukihiro Matsumoto, it mentions that Ruby’s design philosophy is: development efficiency is greater than runtime efficiency, making it a “user-friendly” language.

Most importantly, writing in Ruby is really enjoyable, isn’t it?

Lastly, may I ask if you are happy?

Translated by gpt-3.5-turbo