Skip to content

Commit 1809e08

Browse files
Copilotmrjf
andauthored
Merge origin/main (a5e0b23): resolve all conflicts, keep main's CI-validated features + unique branch additions
Agent-Logs-Url: https://github.com/githubnext/tsessebe/sessions/95f77242-1e2f-4067-b5e3-4cea9a9ba1f8 Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent d35bf99 commit 1809e08

681 files changed

Lines changed: 17016 additions & 265 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/autoloop.lock.yml

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/autoloop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ on:
2424

2525
permissions: read-all
2626

27-
timeout-minutes: 45
27+
timeout-minutes: 360
2828

2929
network:
3030
allowed:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Benchmark: DataFrame.map formatter on 10k-row DataFrame"""
2+
import json, time
3+
import pandas as pd
4+
5+
ROWS = 10_000
6+
WARMUP = 3
7+
ITERATIONS = 10
8+
df = pd.DataFrame({"a": [i * 1.234 for i in range(ROWS)], "b": [i * 5.678 for i in range(ROWS)]})
9+
10+
for _ in range(WARMUP):
11+
df.map(lambda v: f"{v:.2f}")
12+
13+
start = time.perf_counter()
14+
for _ in range(ITERATIONS):
15+
df.map(lambda v: f"{v:.2f}")
16+
total = (time.perf_counter() - start) * 1000
17+
print(json.dumps({"function": "apply_dataframe_formatter", "mean_ms": total / ITERATIONS, "iterations": ITERATIONS, "total_ms": total}))
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Benchmark: apply formatter to 100k-element pandas Series"""
2+
import json, time
3+
import pandas as pd
4+
5+
ROWS = 100_000
6+
WARMUP = 3
7+
ITERATIONS = 10
8+
s = pd.Series([i * 1.234 for i in range(ROWS)])
9+
10+
for _ in range(WARMUP):
11+
s.map(lambda v: f"{v:.2f}")
12+
13+
start = time.perf_counter()
14+
for _ in range(ITERATIONS):
15+
s.map(lambda v: f"{v:.2f}")
16+
total = (time.perf_counter() - start) * 1000
17+
print(json.dumps({"function": "apply_series_formatter", "mean_ms": total / ITERATIONS, "iterations": ITERATIONS, "total_ms": total}))
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Benchmark: np.arange and np.linspace generating 100k-element arrays"""
2+
import json, time
3+
import numpy as np
4+
5+
N = 100_000
6+
WARMUP = 3
7+
ITERATIONS = 10
8+
9+
for _ in range(WARMUP):
10+
np.arange(0, N, 1)
11+
np.linspace(0, 1, N)
12+
13+
start = time.perf_counter()
14+
for _ in range(ITERATIONS):
15+
np.arange(0, N, 1)
16+
np.linspace(0, 1, N)
17+
total = (time.perf_counter() - start) * 1000
18+
print(json.dumps({"function": "arange_linspace", "mean_ms": total / ITERATIONS, "iterations": ITERATIONS, "total_ms": total}))
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""Benchmark: Series.astype() — cast Series dtype."""
2+
import json, time
3+
import pandas as pd
4+
5+
SIZE = 100_000
6+
WARMUP = 5
7+
ITERATIONS = 50
8+
9+
float_series = pd.Series([i * 1.5 for i in range(SIZE)])
10+
int_series = pd.Series([i for i in range(SIZE)])
11+
12+
for _ in range(WARMUP):
13+
float_series.astype("int32")
14+
int_series.astype("float64")
15+
int_series.astype("str")
16+
17+
times = []
18+
for _ in range(ITERATIONS):
19+
t0 = time.perf_counter()
20+
float_series.astype("int32")
21+
int_series.astype("float64")
22+
int_series.astype("str")
23+
times.append((time.perf_counter() - t0) * 1000)
24+
25+
total_ms = sum(times)
26+
print(json.dumps({"function":"astype_series","mean_ms":round(total_ms/ITERATIONS,3),"iterations":ITERATIONS,"total_ms":round(total_ms,3)}))
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Benchmark: pandas Series attrs advanced — individual attr get/set/delete/copy/merge"""
2+
import json, time
3+
import pandas as pd
4+
5+
WARMUP = 3
6+
ITERATIONS = 1_000
7+
8+
s = pd.Series(range(1_000))
9+
s2 = pd.Series(range(1_000))
10+
11+
for _ in range(WARMUP):
12+
s.attrs["unit"] = "meters"
13+
_ = s.attrs.get("unit")
14+
_ = bool(s.attrs)
15+
s2.attrs.update(dict(s.attrs))
16+
s.attrs.update({"version": 1})
17+
s.attrs.pop("unit", None)
18+
s.attrs.clear()
19+
20+
start = time.perf_counter()
21+
for i in range(ITERATIONS):
22+
s.attrs["unit"] = "meters"
23+
_ = s.attrs.get("unit")
24+
_ = bool(s.attrs)
25+
s2.attrs.update(dict(s.attrs))
26+
s.attrs.update({"version": i})
27+
s.attrs.pop("unit", None)
28+
s.attrs.clear()
29+
total = (time.perf_counter() - start) * 1000
30+
print(json.dumps({"function": "attrs_advanced", "mean_ms": total / ITERATIONS, "iterations": ITERATIONS, "total_ms": total}))
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pandas as pd, time, json
2+
N = 100_000
3+
s = pd.Series(range(N))
4+
s.attrs = {"a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6, "g": 7, "h": 8}
5+
WARMUP = 3
6+
ITERS = 10_000
7+
for _ in range(WARMUP):
8+
_ = len(s.attrs)
9+
_ = list(s.attrs.keys())
10+
t0 = time.perf_counter()
11+
for _ in range(ITERS):
12+
_ = len(s.attrs)
13+
_ = list(s.attrs.keys())
14+
total = (time.perf_counter() - t0) * 1000
15+
print(json.dumps({"function": "attrs_count_keys", "mean_ms": total / ITERS, "iterations": ITERS, "total_ms": total}))
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pandas as pd, time, json
2+
N = 10_000
3+
s = pd.Series(range(N))
4+
attrs_data = {"unit": "meters", "created": "2024-01-01", "source": "sensor-1", "version": 2}
5+
WARMUP = 3
6+
ITERS = 100
7+
for _ in range(WARMUP):
8+
s.attrs.update(attrs_data)
9+
_ = dict(s.attrs)
10+
s.attrs["version"] = 99
11+
s2 = s.copy()
12+
s2.attrs.update({"extra": "x"})
13+
t0 = time.perf_counter()
14+
for i in range(ITERS):
15+
s.attrs.update(attrs_data)
16+
_ = dict(s.attrs)
17+
s.attrs["version"] = i
18+
s2 = s.copy()
19+
s2.attrs.update({"extra": "x"})
20+
total = (time.perf_counter() - t0) * 1000
21+
print(json.dumps({"function": "attrs_ops", "mean_ms": total / ITERS, "iterations": ITERS, "total_ms": total}))

benchmarks/pandas/bench_between.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""Benchmark: Series.between() — element-wise range check."""
2+
import json, time
3+
import pandas as pd
4+
5+
SIZE = 100_000
6+
WARMUP = 5
7+
ITERATIONS = 50
8+
9+
s = pd.Series([float(i) for i in range(SIZE)])
10+
11+
for _ in range(WARMUP):
12+
s.between(25000.0, 75000.0)
13+
14+
times = []
15+
for _ in range(ITERATIONS):
16+
t0 = time.perf_counter()
17+
s.between(25000.0, 75000.0)
18+
times.append((time.perf_counter() - t0) * 1000)
19+
20+
total_ms = sum(times)
21+
print(json.dumps({"function":"between","mean_ms":round(total_ms/ITERATIONS,3),"iterations":ITERATIONS,"total_ms":round(total_ms,3)}))

0 commit comments

Comments
 (0)