Skip to content

Instantly share code, notes, and snippets.

View tanner0101's full-sized avatar
💭
💧

Tanner tanner0101

💭
💧
View GitHub Profile
@tanner0101
tanner0101 / app.js
Created June 13, 2016 02:50
Express Benchmark
const express = require('express');
const app = express();
const sqlite3 = require('sqlite3');
const db = new sqlite3.Database('../database/test.sqlite');
app.get('/plaintext', function(req, res) {
res.setHeader('Content-Type', 'text/plain');
res.send('Hello, World!');
});
@tanner0101
tanner0101 / laravel.conf
Created June 13, 2016 02:48
Laravel Benchmark
server {
listen 8701;
root /home/helper/laravel-tanner/benchmark/public;
index index.php index.html index.htm;
server_name 107.170.131.198;
location / {
try_files $uri $uri/ /index.php?$query_string;
@tanner0101
tanner0101 / routes.php
Created June 13, 2016 02:47
Lumen Benchmark
<?php
$app->get('/plaintext', function() {
return 'Hello, world!';
});
$app->get('/json', function() {
return [
'array' => [1, 2, 3],
'dict' => [
@tanner0101
tanner0101 / routes.php
Last active October 26, 2016 23:54
Laravel Benchmark
<?php
use DB;
Route::get('/plaintext', function() {
return 'Hello, world!';
});
Route::get('/json', function() {
return [
@tanner0101
tanner0101 / routes.rb
Created June 13, 2016 02:42
Ruby Benchmark
Rails.application.routes.draw do
get 'plaintext' => 'benchmark#plaintext'
get 'json' => 'benchmark#json'
get 'sqlite-fetch' => 'benchmark#sqlite'
end
@tanner0101
tanner0101 / database.yml
Created June 13, 2016 02:40
Rails Benchmark
production:
<<: *default
database: /home/helper/database/test.sqlite
class BenchmarkController < ActionController::Base
def plaintext
render plain: "Hello world"
end
def json
a = [1, 2, 3]
d = {"one" => 1, "two" => 2, "three" => 3}
r = {"array" => a, "dict" => d, "int" => 42, "string" => "test", "double" => 3.14, "null" => nil}
@tanner0101
tanner0101 / main.swift
Last active June 13, 2016 02:36
Vapor Benchmark
import Vapor
import Fluent
import FluentSQLite
let app = Application()
do {
let driver = try SQLiteDriver(path: "/home/helper/database/test.sqlite")
Database.default = Database(driver: driver)
} catch {
public typealias Byte = UInt8
public struct Data {
public var bytes: [Byte]
public init(_ bytes: [Byte]) {
self.bytes = bytes
}
}
@tanner0101
tanner0101 / vapor-protocols.swift
Last active May 7, 2016 22:47
Vapor Protocols
import Foundation
import Vapor
/**
* This protocol defines router objects that can be used to relay
* different paths to the application
*/
public protocol RouterDriver {
func route(request: Request) -> Request.Handler?