Skip to content

Instantly share code, notes, and snippets.

View sdogruyol's full-sized avatar
🏠
Working from home

Serdar Dogruyol - Sedo セド sdogruyol

🏠
Working from home
View GitHub Profile
require "http/server"
server = HTTP::Server.new "0.0.0.0", 8080 do |context|
context.response.headers["Content-Type"] = "text/event-stream"
stream_channel = Channel(String).new
spawn do
loop do
sleep 0.1
stream_channel.send "Hello World"
end

Backend Developer

We are looking for team mates which are comfortable with technologies below:

  • Strong OOP principles with a keen eye to clean code
  • You know Ruby, not just Rails.
  • You know how HTTP work and can bend REST to your will.
  • You use *NIX based operating systems. (OS X, Linux derivatives)
  • Git <3
require "benchmark"
require "json"
class MenuItem
def self.all
h = {
"name": "Serdar",
"age": 27,
"email": "dogruyolserdar@gmail.com",
require "kemal"
require "benchmark"
def create_ws_request_and_return_io(handler, request)
io = MemoryIO.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
begin
handler.call context
rescue IO::Error
require "kemal"
logging false
get "/" do
"Hello World!"
end
require "kemal"
logging false
# OAuth Authorizations
get "/authorizations" do
""
end
get "/authorizations/:id" do
""

Kemal Crystal v0.10.0 vs new-fibers

This benchmark demonstrates the new-fibers improvements via Kemal.

# app.cr
require "kemal"

get "/" do
 "Hello World"

Kemal vs Sinatra Benchmark

This is just for demonstration purpose. A simple app just returning "Hello World". First in Kemal (Crystal) and then in Sinatra(Ruby with thin).

Kemal (Crystal)

Kemal Version: 0.6.0 Crystal Version: 0.10.0

@sdogruyol
sdogruyol / http-server-benchmark.md
Last active December 27, 2015 00:09
fast-http-server (https://github.com/sdogruyol/fast-http-server) performance benchmark.

This is done with a demo bootstrap static site which includes js, css

wrk is used for benchmarking with

wrk -c 100 -d 20 http://localhost:3000

Fast

Numbers speak louder than words.

Crystal vs Node.js Websocket Benchmark

Crystal 0.9.1 with Kemal

require "kemal"

ws "/" do |socket|
  socket.on_message do |message|
 end