fork of https://github.com/kemalcr/kemal
df359d66c9
Right now every `match?` performed against the routes defined result in a new Regex compiled for the exact same `@path`. Since `@path` of the Route does not change on every request, we pre-build it to avoid repeated allocations. When testing this in release mode (against 0.10.2 [d1e3f0b]): Before: 32408.48 req/s After: 34862.07 req/s |
||
---|---|---|
samples | ||
spec | ||
src | ||
.gitignore | ||
.travis.yml | ||
Guardfile | ||
README.md | ||
shard.yml |
# Kemal [![Build Status](https://travis-ci.org/sdogruyol/kemal.svg?branch=master)](https://travis-ci.org/sdogruyol/kemal)
Lightning Fast, Super Simple web framework for Crystal. Inspired by Sinatra but with superior performance and built-in WebSocket support.
Kemal is under heavy development and currently supports Crystal latest.
Super Simple <3
require "kemal"
# Matches GET "http://host:port/"
get "/" do
"Hello World!"
end
# Creates a WebSocket handler.
# Matches "ws://host:port/socket"
ws "/socket" do |socket|
socket.send "Hello from Kemal!"
end
Build and run!
crystal run src/kemal_sample.cr
Go to http://localhost:3000
Check documentation or samples for more.
Super Fast <3
Numbers speak louder than words.
Framework | Request Per Second | Avg. Response Time |
---|---|---|
Kemal (Production) | 64986 | 170μs |
Sinatra (Thin) | 2274 | 43.82ms |
These results were achieved with wrk
on a Macbook Pro Late 2013. (2Ghz i7 8GB Ram OS X Yosemite)
Features
- Support all REST verbs
- Websocket support
- Request/Response context, easy parameter handling
- Middlewares
- Built-in JSON support
- Built-in static file serving
- Built-in view templating via ecr
Documentation
You can read the documentation at the official site kemalcr.com
Thanks
Thanks to Manas for their awesome work on Frank.