Skip to content

Instantly share code, notes, and snippets.

View gilsondev's full-sized avatar
💼
Work

Gilson Filho (bilbo) gilsondev

💼
Work
View GitHub Profile
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.

Performance of Flask, Tornado, GEvent, and their combinations

Wensheng Wang, 10/1/11

Source: http://blog.wensheng.org/2011/10/performance-of-flask-tornado-gevent-and.html

When choosing a web framework, I pretty much have eyes set on Tornado. But I heard good things about Flask and Gevent. So I tested the performance of each and combinations of the three. I chose something just a little more advanced than a "Hello World" program to write - one that use templates. Here are the codes:

1, Pure Flask (pure_flask.py)

@funkotron
funkotron / docker_create_treeio.sh
Last active December 18, 2019 17:56
Using Docker (requires docker to be installed http://www.docker.io/gettingstarted/ ), spawn a postgresql instance and a dynamically configured treeio instance.
#!/bin/bash
# Description: Using Docker (requires docker to be installed http://www.docker.io/gettingstarted/ ), spawn a postgresql instance and a dynamically configured treeio instance
# Also requires postgresql client tools http://www.postgresql.org/download/linux/ubuntu/
# Run chmod +x to make this file executable then run it: ./docker_create_treeio.sh
# Author: Adam Awan
# Email: adam@tree.io
# Set the port to forward for Tree.io
TREEIO_PORT="80"
@fmasanori
fmasanori / gamename.py
Last active December 17, 2015 13:19
Jogo de advinhar um nome feminino entre os mais frequentes no Brasil (feito por uma menina de 12 anos)
import random
nomes = '''Júlia Sophia Isabella Manuela Giovanna Alice Laura
Luiza Beatriz Mariana Yasmin Gabriela Rafaela Isabelle Lara
Letícia Valentina Nicole Sarah Vitória Isadora Lívia Helena
Lorena Clara Larissa Emanuelly Heloisa Marina Melissa Gabrielly
Eduarda Rebeca Amanda Alícia Bianca Lavínia Fernanda Ester
Carolina Emily Cecília Pietra Milena Marcela Laís Natália
Maria Bruna Camila Luana Catarina Olivia Agatha Mirella
Sophie Stella Stefany Isabel Kamilly Elisa Luna Eloá Joana
Mariane Bárbara Juliana Rayssa Alana Caroline Brenda Evelyn
@yarysh
yarysh / JSONResponseMixin.py
Created May 7, 2013 10:00
JSON response mixin for Django CBV.
#!/usr/bin/python
# coding: utf-8
import json
class JSONResponseMixin(object):
"""
A mixin that can be used to render a JSON response.
"""
@rouge8
rouge8 / fields.py
Created April 23, 2013 16:28
Django REST Framework JSON Field
import json
from rest_framework import serializers
class JSONField(serializers.WritableField):
def to_native(self, obj):
return json.dumps(obj)
def from_native(self, value):
return json.loads(value)
@berlotto
berlotto / record-screencast.sh
Last active December 14, 2015 07:58
Record screencast from with sound in MP4 h264/AAC codecs
avconv -f alsa -i pulse -f x11grab -r 30 -s 1366x768 -i :0.0 -vcodec libx264 -preset ultrafast -ab 320k -threads 8 myscreencast.mp4
@senko
senko / singleton.py
Created February 25, 2013 08:01
Singleton Django Model
# Written by Senko Rasic <senko.rasic@goodcode.io>
# Released into Public Domain. Use it as you like.
from django.db import models
class SingletonModel(models.Model):
"""Singleton Django Model
Ensures there's always only one entry in the database, and can fix the
@iartarisi
iartarisi / gist:4078879
Created November 15, 2012 14:28
mock open file
@contextmanager
def mock_open(filename, contents=None, complain=True):
"""Mock __builtin__.open() on a specific filename
Let execution pass through to __builtin__.open() on other
files. Return a BytesIO with :contents: if the file was matched. If
the :contents: parameter is not given or if it None, a BytesIO
instance simulating an empty file is returned.
If :complain: is True (default). Will raise an error if a
@TBonnin
TBonnin / git-remove-branches
Last active May 27, 2023 14:44
Safely remove local fully merged branches
#!/bin/bash
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches