Skip to content

Commit 8606548

Browse files
authored
Merge pull request #1 from ms2892/add-benchmarks
Add benchmarks
2 parents ae14c86 + 2c5fce7 commit 8606548

11 files changed

+3154
-78
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,8 @@ dmypy.json
165165

166166
# Cython debug symbols
167167
cython_debug/
168+
169+
# Benchmarks created my asv
170+
pystack/**
171+
.asv/**
172+
.vscode/**

.vscode/settings.json

Lines changed: 0 additions & 78 deletions
This file was deleted.

asv.conf.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version":1,
3+
"benchmark_dir": "./benchmarks",
4+
"repo":"[email protected]:bloomberg/pystack.git",
5+
"project": "pystack",
6+
"project_url": "https://github.com/bloomberg/pystack",
7+
"env_dir":".asv/env",
8+
"results_dir":".asv/results",
9+
"html_dir":".asv/html",
10+
"environment_type":"conda",
11+
"dvcs":"git",
12+
"branches":["main"],
13+
"install_command":[
14+
"python -mpip install -r requirements-test.txt -r requirements-extra.txt",
15+
"python -mpip install -e ."
16+
],
17+
"build_command":[
18+
"python -mpip install pkgconfig",
19+
"python -mpip install dbg"
20+
]
21+
}

benchmarks/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Using the Benchmarking Tool
2+
3+
One of the prerequisites is to have the respective libraries installed. Hence do install the following libraries
4+
5+
- libdw
6+
- libelf
7+
8+
These can be installed via the command `apt-get install libdw-dev libelf-dev`.
9+
10+
To benchmark the packages present another tool is used called `airspeed velocity`. To install it please run the follow command
11+
12+
```pip install asv```
13+
14+
In the parent directory run the following command to get a brief benchmark of your current packages
15+
16+
```asv run```
17+
18+
Use the `-v` flag to get a verbose output.
19+
20+
To compare the all the commits across all the branches you may make use of the following command.
21+
22+
```asv run ALL```
23+
24+
To run benchmarks from a particular commit or tag you can use the commit hash or the tag
25+
26+
```asv run [TAG|HASH]..[branch]```
27+
28+
To compare between tags
29+
30+
```asv show [TAG]..[branch]```
31+
32+
To have a local server to display all the graphs
33+
34+
```asv publish```

benchmarks/__init__.py

Whitespace-only changes.

benchmarks/benchmark_colors.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from pystack.colors import *
2+
3+
RANGE=100
4+
5+
class ColorsBenchmarkSuite:
6+
7+
def setup(self):
8+
pass
9+
10+
def time_colored(self):
11+
colors = ["red","green","yellow","blue","magenta","cyan","white"]
12+
highlights = ["on_red","on_green","on_yellow","on_blue","on_magenta","on_cyan","on_white"]
13+
attributes = ["bold", "dark", "underline", "blink", "reverse", "concealed"]
14+
for counter in range(RANGE):
15+
for color in colors:
16+
for highlight in highlights:
17+
colored("Benchmark Colored",color,highlight,attributes)
18+
return "Successfully Benchmarks colored"
19+
20+
def time_format_colored(self):
21+
colors=[
22+
"grey",
23+
"red",
24+
"green",
25+
"yellow",
26+
"blue",
27+
"magenta",
28+
"cyan",
29+
"white",
30+
]
31+
highlights=[
32+
"on_grey",
33+
"on_red",
34+
"on_green",
35+
"on_yellow",
36+
"on_blue",
37+
"on_magenta",
38+
"on_cyan",
39+
"on_white",
40+
]
41+
attributes=[
42+
"bold",
43+
"faint",
44+
"italized",
45+
"underline",
46+
"blink",
47+
"reverse",
48+
"concealed",
49+
]
50+
for counter in range(RANGE):
51+
for color in colors:
52+
for highlight in highlights:
53+
format_colored("Benchmark Format Colored",color,highlight,attributes)
54+
return "Successfully Benchmarks format_colored"

0 commit comments

Comments
 (0)