Skip to content

Commit 5b1fe18

Browse files
committed
Add minimum performance goals, document them
1 parent 8f7c83c commit 5b1fe18

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ These goals should define the future development of the library.
1515
- It does not need to exactly replicate the syntax and oddities of SystemVerilog, but it must adhere to the principle of declariative randomization.
1616
- Repeatable, i.e. works deterministically with the same seed.
1717
- Fast. Or at least as fast as can be expected from a Python library rather than say C/C++.
18-
- Originally, the creation of the library was motivated by [`pyvsc`](https://github.com/fvutils/pyvsc). `pyvsc` is feature-rich and user-friendly for those with an SV background, but not fast enough for production usage.
18+
- Originally, the creation of the library was motivated by [`pyvsc`](https://github.com/fvutils/pyvsc).
19+
- `pyvsc` is feature-rich and user-friendly for those with an SV background, but we found it was not fast enough for production usage.
20+
- This library aims to achieve at least a 10x speedup over `pyvsc`. See the `benchmarks/` directory or run `python -m benchmarks` for testing.
1921

2022
## Motivation
2123
Why bother with a Python library for this? Why not just use procedural randomization?

benchmarks/__main__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def test_basic(self):
7575
randobjs = {'vsc': vsc_basic(), 'cr': cr_basic(Random(0))}
7676
def check(results):
7777
self.assertGreater(results['cr'][1], results['vsc'][1])
78+
# This testcase is typically 40-50x faster, which may vary depending
79+
# on machine. Ensure it doesn't fall below 30x.
80+
speedup = results['cr'][1] / results['vsc'][1]
81+
self.assertGreater(speedup, 30, "Performance has degraded!")
7882
self.run_benchmark(randobjs, 100, check)
7983

8084
def test_in(self):
@@ -88,6 +92,10 @@ def test_in(self):
8892
}
8993
def check(results):
9094
self.assertGreater(results['cr'][1], results['vsc'][1])
95+
# This testcase is typically 13-15x faster, which may vary depending
96+
# on machine. Ensure it doesn't fall below 10x.
97+
speedup = results['cr'][1] / results['vsc'][1]
98+
self.assertGreater(speedup, 10, "Performance has degraded!")
9199
self.run_benchmark(randobjs, 100, check)
92100

93101
def test_ldinstr(self):
@@ -100,6 +108,10 @@ def test_ldinstr(self):
100108
}
101109
def check(results):
102110
self.assertGreater(results['cr'][1], results['vsc'][1])
111+
# This testcase is typically 13-15x faster, which may vary depending
112+
# on machine. Ensure it doesn't fall below 10x.
113+
speedup = results['cr'][1] / results['vsc'][1]
114+
self.assertGreater(speedup, 10, "Performance has degraded!")
103115
self.run_benchmark(randobjs, 100, check)
104116

105117

0 commit comments

Comments
 (0)