Sha256: 32c4b99f3f8d11653eef2ccc034844445df48d393919592b63258e115d1f7636

Contents?: true

Size: 597 Bytes

Versions: 9

Compression:

Stored size: 597 Bytes

Contents

#!/usr/bin/env falcon --verbose serve -c
# frozen_string_literal: true

class Benchmark
	def initialize(app)
		@app = app
	end
	
	PATH_INFO = 'PATH_INFO'.freeze
	
	SMALL = [200, {}, ["Hello World\n" * 10] * 10].freeze
	
	def small(env)
		SMALL
	end
	
	BIG = [200, {}, ["Hello World\n" * 1000] * 1000].freeze
	
	def big(env)
		BIG
	end
	
	def call(env)
		_, name, *path = env[PATH_INFO].split("/")
		
		method = name&.to_sym
		
		if method and self.respond_to?(method)
			self.send(method, env)
		else
			@app.call(env)
		end
	end
end

use Benchmark

run lambda {|env| [200, {}, ["Hello World"]]}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
falcon-0.36.4 examples/benchmark/config.ru
falcon-0.36.3 examples/benchmark/config.ru
falcon-0.36.2 examples/benchmark/config.ru
falcon-0.36.1 examples/benchmark/config.ru
falcon-0.36.0 examples/benchmark/config.ru
falcon-0.35.6 examples/benchmark/config.ru
falcon-0.35.5 examples/benchmark/config.ru
falcon-0.35.4 examples/benchmark/config.ru
falcon-0.35.3 examples/benchmark/config.ru