Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boilerplate to run the test (benchmark) with mutiple env #1

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -49,6 +49,7 @@ coverage.xml

# Django stuff:
*.log
db.sqlite3

# Sphinx documentation
docs/_build/
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -0,0 +1 @@
recursive-include django_perf_project *.html
11 changes: 11 additions & 0 deletions README.md
@@ -0,0 +1,11 @@
# django-perf-tester

The goal of this project is to benchmark pypy against python 2.7

## Installation

* Create a virtualenv `virtualenv -p /usr/bin/pypy pypy_venv`
* cd into this new virtualenv and activate it`. bin/activate`
* `pip install -e git+https://github.com/yml/django-perf-tester#egg=django-perf-tester`
* pip install the requirements `pip install -r src/django-perf-tester/requirements.txt`
* run `tox -c src/django-perf-tester/tox.ini`
7 changes: 7 additions & 0 deletions benchmark_vm.sh
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -ex

docker rm django-perf; docker run -t --name=django-perf -v "$PWD":/usr/src/django-perf -w /usr/src/django-perf pypy:2-5.1.1 bash -c "ln -sf /usr/local/bin/pypy /usr/local/bin/python; bash test.sh" > result_test_pypy.txt
docker rm django-perf; docker run -t --name=django-perf -v "$PWD":/usr/src/django-perf -w /usr/src/django-perf python:2.7.11 bash test.sh > result_test_python2.7.11.txt
docker rm django-perf; docker run -t --name=django-perf -v "$PWD":/usr/src/django-perf -w /usr/src/django-perf pyston/pyston bash test.sh > result_test_pyston.txt
File renamed without changes.
File renamed without changes.
File renamed without changes.
88 changes: 88 additions & 0 deletions django_perf_project/apps/botbotperf/migrations/0001_initial.py
@@ -0,0 +1,88 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
]

operations = [
migrations.CreateModel(
name='ActivePlugin',
fields=[
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, help_text='', auto_created=True)),
('configuration', models.TextField(blank=True, default={}, help_text=b'User-specified attributes for this plugin {"username": "joe", "api-key": "foo"}')),
],
),
migrations.CreateModel(
name='Channel',
fields=[
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, help_text='', auto_created=True)),
('created', models.DateTimeField(help_text='', auto_now_add=True)),
('updated', models.DateTimeField(help_text='', auto_now=True)),
('name', models.CharField(max_length=250, help_text=b'IRC expects room name: #django')),
('slug', models.SlugField(help_text='')),
('private_slug', models.SlugField(unique=True, blank=True, null=True, help_text=b'Slug used for private rooms')),
('password', models.CharField(max_length=250, blank=True, null=True, help_text=b'Password (mode +k) if the channel requires one')),
('status', models.CharField(max_length=20, default=b'PENDING', choices=[(b'PENDING', b'Pending'), (b'ACTIVE', b'Active'), (b'ARCHIVED', b'Archived'), (b'BANNED', b'Banned')], help_text='')),
('is_public', models.BooleanField(default=False, help_text='')),
('is_featured', models.BooleanField(default=False, help_text='')),
('public_kudos', models.BooleanField(default=True, help_text='')),
('fingerprint', models.CharField(max_length=36, blank=True, null=True, help_text='')),
('notes', models.TextField(blank=True, help_text='')),
],
options={
'ordering': ('name',),
},
),
migrations.CreateModel(
name='ChatBot',
fields=[
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, help_text='', auto_created=True)),
('is_active', models.BooleanField(default=False, help_text='')),
('server', models.CharField(max_length=100, help_text=b'Format: irc.example.net:6697')),
('server_password', models.CharField(max_length=100, blank=True, null=True, help_text=b'IRC server password - PASS command. Optional')),
('server_identifier', models.CharField(max_length=164, help_text='')),
('nick', models.CharField(max_length=64, help_text='')),
('password', models.CharField(max_length=100, blank=True, null=True, help_text=b'Password to identify with NickServ. Optional.')),
('real_name', models.CharField(max_length=250, help_text=b'Usually a URL with information about this bot.')),
('slug', models.CharField(max_length=50, db_index=True, help_text='')),
('max_channels', models.IntegerField(default=200, help_text='')),
],
),
migrations.CreateModel(
name='Plugin',
fields=[
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, help_text='', auto_created=True)),
('name', models.CharField(max_length=100, help_text='')),
('slug', models.SlugField(help_text='')),
],
),
migrations.AddField(
model_name='channel',
name='chatbot',
field=models.ForeignKey(help_text='', to='botbotperf.ChatBot'),
),
migrations.AddField(
model_name='channel',
name='plugins',
field=models.ManyToManyField(help_text='', to='botbotperf.Plugin', through='botbotperf.ActivePlugin'),
),
migrations.AddField(
model_name='activeplugin',
name='channel',
field=models.ForeignKey(help_text='', to='botbotperf.Channel'),
),
migrations.AddField(
model_name='activeplugin',
name='plugin',
field=models.ForeignKey(help_text='', to='botbotperf.Plugin'),
),
migrations.AlterUniqueTogether(
name='channel',
unique_together=set([('slug', 'chatbot'), ('name', 'chatbot')]),
),
]
23 changes: 23 additions & 0 deletions django_perf_project/apps/botbotperf/migrations/0002_usercount.py
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('botbotperf', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='UserCount',
fields=[
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, help_text='', auto_created=True)),
('dt', models.DateField(help_text='')),
('counts', models.IntegerField(help_text='')),
('channel', models.ForeignKey(help_text='', to='botbotperf.Channel')),
],
),
]
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('botbotperf', '0002_usercount'),
]

operations = [
migrations.CreateModel(
name='Log',
fields=[
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, help_text='', auto_created=True)),
('timestamp', models.DateTimeField(db_index=True, help_text='')),
('nick', models.CharField(max_length=255, help_text='')),
('text', models.TextField(help_text='')),
('action', models.BooleanField(default=False, help_text='')),
('command', models.CharField(max_length=50, blank=True, null=True, help_text='')),
('host', models.TextField(blank=True, null=True, help_text='')),
('raw', models.TextField(blank=True, null=True, help_text='')),
('room', models.CharField(max_length=100, blank=True, null=True, help_text='')),
('bot', models.ForeignKey(null=True, help_text='', to='botbotperf.ChatBot')),
('channel', models.ForeignKey(null=True, help_text='', to='botbotperf.Channel')),
],
options={
'ordering': ('-timestamp',),
},
),
migrations.AlterIndexTogether(
name='log',
index_together=set([('channel', 'timestamp')]),
),
]
Empty file.