Skip to content

Commit

Permalink
test: benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Jan 5, 2024
1 parent 138379e commit b55bfd5
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 3 deletions.
203 changes: 203 additions & 0 deletions .benchmarks/Darwin-CPython-3.10-64bit/0002_compile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"machine_info": {
"node": "Cederoth.local",
"processor": "i386",
"machine": "x86_64",
"python_compiler": "Clang 15.0.0 (clang-1500.0.40.1)",
"python_implementation": "CPython",
"python_implementation_version": "3.10.13",
"python_version": "3.10.13",
"python_build": [
"main",
"Jan 2 2024 12:42:16"
],
"release": "23.1.0",
"system": "Darwin",
"cpu": {
"python_version": "3.10.13.final.0 (64 bit)",
"cpuinfo_version": [
9,
0,
0
],
"cpuinfo_version_string": "9.0.0",
"arch": "X86_64",
"bits": 64,
"count": 16,
"arch_string_raw": "x86_64",
"vendor_id_raw": "GenuineIntel",
"brand_raw": "Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz",
"hz_advertised_friendly": "2.3000 GHz",
"hz_actual_friendly": "2.3000 GHz",
"hz_advertised": [
2300000000,
0
],
"hz_actual": [
2300000000,
0
],
"l2_cache_size": 262144,
"stepping": 13,
"model": 158,
"family": 6,
"flags": [
"1gbpage",
"3dnowprefetch",
"abm",
"acapmsr",
"acpi",
"adx",
"aes",
"apic",
"avx",
"avx1.0",
"avx2",
"bmi1",
"bmi2",
"clflush",
"clflushopt",
"clfsh",
"clfsopt",
"cmov",
"cx16",
"cx8",
"de",
"ds",
"ds_cpl",
"dscpl",
"dtes64",
"dts",
"em64t",
"erms",
"est",
"f16c",
"fma",
"fpu",
"fpu_csds",
"fxsr",
"ht",
"htt",
"ibrs",
"intel_pt",
"invpcid",
"ipt",
"l1df",
"lahf",
"lahf_lm",
"lzcnt",
"mca",
"mce",
"mdclear",
"mmx",
"mon",
"monitor",
"movbe",
"mpx",
"msr",
"mtrr",
"osxsave",
"pae",
"pat",
"pbe",
"pcid",
"pclmulqdq",
"pdcm",
"pge",
"pni",
"popcnt",
"prefetchw",
"pse",
"pse36",
"rdrand",
"rdrnd",
"rdseed",
"rdtscp",
"rdwrfsgs",
"seglim64",
"sep",
"sgx",
"sgx_lc",
"sgxlc",
"smap",
"smep",
"smx",
"ss",
"ssbd",
"sse",
"sse2",
"sse3",
"sse4.1",
"sse4.2",
"sse4_1",
"sse4_2",
"ssse3",
"stibp",
"syscall",
"tm",
"tm2",
"tpr",
"tsc",
"tsc_thread_offset",
"tscdeadline",
"tsci",
"tsctmr",
"vme",
"vmx",
"x2apic",
"xd",
"xsave",
"xtpr"
],
"l2_cache_line_size": 256,
"l2_cache_associativity": 6
}
},
"commit_info": {
"id": "138379e0618e39eb3d9ea3d8e438786bc97a77fd",
"time": "2024-01-05T13:58:38-06:00",
"author_time": "2024-01-05T13:58:38-06:00",
"dirty": true,
"project": "ape-solidity",
"branch": "perf/del-unused-astnode-logic"
},
"benchmarks": [
{
"group": null,
"name": "test_compile_performance",
"fullname": "tests/test_compiler.py::test_compile_performance",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 0.3701445659971796,
"max": 0.3701445659971796,
"mean": 0.3701445659971796,
"stddev": 0,
"rounds": 1,
"median": 0.3701445659971796,
"iqr": 0.0,
"q1": 0.3701445659971796,
"q3": 0.3701445659971796,
"iqr_outliers": 0,
"stddev_outliers": 0,
"outliers": "0;0",
"ld15iqr": 0.3701445659971796,
"hd15iqr": 0.3701445659971796,
"ops": 2.701647118082019,
"total": 0.3701445659971796,
"iterations": 1
}
}
],
"datetime": "2024-01-05T20:20:42.078976",
"version": "4.0.0"
}
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ addopts = """
--cov-report html
--cov-report xml
--cov=ape_solidity
--benchmark-compare 0002
--benchmark-compare-fail="mean:1.1"
"""
python_files = "test_*.py"
testpaths = "tests"
Expand Down
4 changes: 1 addition & 3 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import re
import shutil
import time
from pathlib import Path

import pytest
Expand Down Expand Up @@ -50,13 +49,12 @@ def test_compile(project, contract):
assert contract.source_id == f"{contract.name}.sol"


@pytest.mark.benchmark(group="compile", timer=time.process_time)
def test_compile_performance(benchmark, compiler, project):
"""
See https://pytest-benchmark.readthedocs.io/en/latest/
"""
source_path = project.contracts_folder / "MultipleDefinitions.sol"
result = benchmark(lambda: compiler.compile([source_path]))
result = benchmark.pedantic(lambda: compiler.compile([source_path]), rounds=1)
assert len(result) > 0


Expand Down

0 comments on commit b55bfd5

Please sign in to comment.