diff options
Diffstat (limited to 'research')
| -rwxr-xr-x | research/experiments/009-runtime-drafts/run.py | 8 | ||||
| -rw-r--r-- | research/experiments/010-one-sync-commit/run.py | 15 | ||||
| -rwxr-xr-x | research/experiments/012-tail-records/run.py | 15 |
3 files changed, 26 insertions, 12 deletions
diff --git a/research/experiments/009-runtime-drafts/run.py b/research/experiments/009-runtime-drafts/run.py index 08ed55d..eb87a25 100755 --- a/research/experiments/009-runtime-drafts/run.py +++ b/research/experiments/009-runtime-drafts/run.py @@ -8,12 +8,12 @@ import subprocess from pathlib import Path HERE = Path(__file__).resolve().parent -CONNECTIONS = HERE.parents[2] / 'prototypes' / 'connections' +ROOT = HERE.parents[2] def main(): parser = argparse.ArgumentParser() - parser.add_argument('--work', type=Path, default=CONNECTIONS / 'build' / 'bench-drafts') + parser.add_argument('--work', type=Path, default=ROOT / 'build' / 'bench-drafts') parser.add_argument('--size', type=int, default=1048576) parser.add_argument('--saves', type=int, default=24) parser.add_argument('--rounds', type=int, default=3) @@ -24,8 +24,8 @@ def main(): device = subprocess.check_output(['findmnt', '-n', '-T', str(args.work), '-o', 'SOURCE,FSTYPE'], text=True).split() assert device[1] != 'tmpfs', 'fsync is free on tmpfs' binary = args.work / 'bench' - subprocess.run(['cc', '-std=c17', '-O2', '-Wall', '-Wextra', '-Werror', f'-I{CONNECTIONS}', - str(HERE / 'bench.c'), str(CONNECTIONS / 'store-tree.c'), '-o', str(binary)], check=True) + subprocess.run(['cc', '-std=c17', '-O2', '-Wall', '-Wextra', '-Werror', f'-I{ROOT / "core"}', + str(HERE / 'bench.c'), str(ROOT / 'store' / 'store-tree.c'), '-o', str(binary)], check=True) runs = [] for round_number in range(args.rounds): for mode in (('copy', 'draft') if round_number % 2 == 0 else ('draft', 'copy')): diff --git a/research/experiments/010-one-sync-commit/run.py b/research/experiments/010-one-sync-commit/run.py index 9a01c07..c729358 100644 --- a/research/experiments/010-one-sync-commit/run.py +++ b/research/experiments/010-one-sync-commit/run.py @@ -16,11 +16,18 @@ from pathlib import Path HERE = Path(__file__).resolve().parent ROOT = HERE.parents[2] -PURE = ROOT / 'prototypes' / 'connections' +CORE = ROOT / 'core' # the store's headers +STORE = ROOT / 'store' / 'store-tree.c' + + +def stored_at(revision): + """Where the tree store was at a revision: store/ now, prototypes/connections/ before.""" + moved = subprocess.run(['git', '-C', str(ROOT), 'cat-file', '-e', f'{revision}:store/store-tree.c'], capture_output=True) + return 'store/store-tree.c' if moved.returncode == 0 else 'prototypes/connections/store-tree.c' def build(output, sources): - subprocess.run(['cc', '-O2', '-std=c17', f'-I{PURE}', '-o', str(output)] + [str(s) for s in sources] + ['-lpthread'], + subprocess.run(['cc', '-O2', '-std=c17', f'-I{CORE}', '-o', str(output)] + [str(s) for s in sources] + ['-lpthread'], check=True) @@ -34,12 +41,12 @@ def main(): with tempfile.TemporaryDirectory() as work: work = Path(work) before = work / 'store-tree-before.c' - before.write_text(subprocess.run(['git', '-C', str(ROOT), 'show', f'{args.before}:prototypes/connections/store-tree.c'], + before.write_text(subprocess.run(['git', '-C', str(ROOT), 'show', f'{args.before}:{stored_at(args.before)}'], capture_output=True, text=True, check=True).stdout) build(work / 'probe', [HERE / 'probe.c']) builds = {'two syncs': work / 'commits-before', 'one sync': work / 'commits-after'} build(builds['two syncs'], [HERE / 'commits.c', before]) - build(builds['one sync'], [HERE / 'commits.c', PURE / 'store-tree.c']) + build(builds['one sync'], [HERE / 'commits.c', STORE]) results = {'rounds': []} for round_ in range(args.rounds): probe = subprocess.run([str(work / 'probe'), str(args.directory)], capture_output=True, text=True, check=True) diff --git a/research/experiments/012-tail-records/run.py b/research/experiments/012-tail-records/run.py index 7fc342e..ed8630b 100755 --- a/research/experiments/012-tail-records/run.py +++ b/research/experiments/012-tail-records/run.py @@ -18,12 +18,19 @@ from pathlib import Path HERE = Path(__file__).resolve().parent ROOT = HERE.parents[2] -PURE = ROOT / 'prototypes' / 'connections' +CORE = ROOT / 'core' # the store's headers +STORE = ROOT / 'store' / 'store-tree.c' COMMITS = HERE.parent / '010-one-sync-commit' / 'commits.c' +def stored_at(revision): + """Where the tree store was at a revision: store/ now, prototypes/connections/ before.""" + moved = subprocess.run(['git', '-C', str(ROOT), 'cat-file', '-e', f'{revision}:store/store-tree.c'], capture_output=True) + return 'store/store-tree.c' if moved.returncode == 0 else 'prototypes/connections/store-tree.c' + + def build(output, sources): - subprocess.run(['cc', '-O2', '-std=c17', f'-I{PURE}', '-o', str(output)] + [str(s) for s in sources] + ['-lpthread'], + subprocess.run(['cc', '-O2', '-std=c17', f'-I{CORE}', '-o', str(output)] + [str(s) for s in sources] + ['-lpthread'], check=True) @@ -37,12 +44,12 @@ def main(): with tempfile.TemporaryDirectory() as work: work = Path(work) before = work / 'store-tree-before.c' - before.write_text(subprocess.run(['git', '-C', str(ROOT), 'show', f'{args.before}:prototypes/connections/store-tree.c'], + before.write_text(subprocess.run(['git', '-C', str(ROOT), 'show', f'{args.before}:{stored_at(args.before)}'], capture_output=True, text=True, check=True).stdout) build(work / 'probe', [HERE / 'probe.c']) builds = {'heads in slots': work / 'commits-before', 'heads as records': work / 'commits-after'} build(builds['heads in slots'], [COMMITS, before]) - build(builds['heads as records'], [COMMITS, PURE / 'store-tree.c']) + build(builds['heads as records'], [COMMITS, STORE]) results = {'rounds': []} for round_ in range(args.rounds): measured = {'probe': [], 'commits': {}} |
