Skip to content

Instantly share code, notes, and snippets.

View perrie625's full-sized avatar

Perrie perrie625

  • Zhejiang, Hangzhou
View GitHub Profile

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)

@perrie625
perrie625 / RedisPythonPubSub1.py
Created July 10, 2017 13:11 — forked from jobliz/RedisPythonPubSub1.py
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@perrie625
perrie625 / gist:30ee377d207c798ab4e9417dbfaf40c4
Created July 3, 2017 08:20 — forked from tmc/gist:787105
gevent nonblocking stdin
import os
import sys
import fcntl
import gevent
from gevent.socket import wait_read
def print_every(s, repeat=1):
print s
if repeat:
@perrie625
perrie625 / bench_test.go
Created May 25, 2017 10:45 — forked from SchumacherFM/bench_test.go
GoLang Benchmark: Map, StringSlice, Array, StructSlice
package main
// run with: $ go test --bench=. -test.benchmem .
// @see https://twitter.com/karlseguin/status/524452778093977600
import (
"math/rand"
"strconv"
"testing"
)
@perrie625
perrie625 / chat.go
Created April 15, 2017 03:12
simple golang chat server
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
@perrie625
perrie625 / nesign.py
Created October 25, 2015 03:47 — forked from rumisle/nesign.py
网易云音乐签到(pc android)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import requests
'''
A module for helping you to finish the daily task on Neteasy Music
'''