Skip to content

[TEST] py4j #575 + CodSpeed (do not merge) - #1

Closed
Tagar wants to merge 3 commits into
masterfrom
pr-575-codspeed
Closed

Tagar wants to merge 3 commits into
masterfrom
pr-575-codspeed

Conversation

@Tagar

@Tagar Tagar commented May 15, 2026

Copy link
Copy Markdown
Member

Test PR for CodSpeed integration on byteoak fork.

Re-applies upstream py4j#575 (remove Python 2 compat + smart_decode
optimization) on top of byteoak/py4j master, with the CodSpeed
integration commit cherry-picked.

Purpose: validate that CodSpeed posts PR-level perf comparisons
automatically when a PR touches Python source. Throwaway PR — not for
merge.

@Tagar Tagar closed this May 15, 2026
@Tagar Tagar reopened this May 15, 2026
@Tagar
Tagar force-pushed the pr-575-codspeed branch from 9e0dd84 to d096398 Compare May 15, 2026 06:50
markjm and others added 3 commits May 15, 2026 00:52
Remove Python 2 compatibility layer since Python 2 is no longer supported.
This simplifies the codebase and improves performance by eliminating
unnecessary type checks and function call overhead.

Changes:
- Remove compat module usage from all main source files
- Replace smart_decode() with direct str() or .decode("utf-8") calls
- Use Python 3 built-ins directly (str, bytes, int, range, Queue, Thread)
- Simplify encode_bytearray/decode_bytearray functions
- Change encode_float to use str() instead of repr() (identical in Python 3)

Benchmark results (isolated microbenchmarks):
- str() vs smart_decode() for integers: 1.90x faster
- str() vs smart_decode() for booleans: 2.61x faster
- str() vs smart_decode() for Decimal: 1.75x faster
- .decode("utf-8") vs smart_decode() for stream reading: 2.01x faster
- Combined protocol overhead reduction: ~15-18%

The compat module is kept for backwards compatibility with any external
code that may import from it, but is no longer used internally.

Co-Authored-By: Claude <noreply@anthropic.com>
Wires the perf framework's micro scenarios (M1-M7) and four
representative macro scenarios (X1-1, X2-10k, X4, X6) into CodSpeed's
walltime measurement on bare-metal Macro Runners.

What it gives us:
- per-PR regression detection on Python protocol code paths
  (M5-M7: encode int/string/float, decode int/string, escape/unescape)
- macro-level regression detection on the round-trip-heavy hot paths
  (X2 javalist iteration, X4 callback round-trips, X6 pool saturation)
- per-commit perf trend on master
- bare-metal measurement environment (<1% variance vs. shared CI noise)

Triggers are intentionally minimal: push to master tracks the trend,
workflow_dispatch lets maintainers run on a PR when a change claims a
perf impact. No PR auto-trigger to keep macro-runner minutes lean.

Macros are exposed via a small pytest-codspeed adapter at
src/py4j/tests/perf/scenarios/codspeed_macros.py - re-uses the existing
MacroScenario classes from scenarios/macro.py, one parametrize entry
per scenario, so each becomes its own tracked benchmark on the
CodSpeed dashboard.

Prerequisite (maintainer action, not in this PR):
- Install the CodSpeed GitHub App on the py4j org:
  https://github.com/apps/codspeed
- Set the CODSPEED_TOKEN repository secret (provided by the App).

Until the App is installed, this workflow's job won't pick up a runner
(codspeed-macro label) and CI on this workflow will queue. No effect
on existing workflows or test runs.

Co-authored-by: Isaac
@Tagar
Tagar force-pushed the pr-575-codspeed branch from d096398 to 8fd7667 Compare May 15, 2026 06:52
@codspeed

codspeed Bot commented May 15, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 27.7%

⚡ 3 improved benchmarks
✅ 13 untouched benchmarks
⏩ 7 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime test_m5a_encode_int 2.1 µs 1.6 µs +28.53%
⚡ WallTime test_m5b_encode_string 3.2 µs 2.3 µs +41.02%
⚡ WallTime test_m5c_encode_float 3.1 µs 2.7 µs +14.88%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing pr-575-codspeed (8fd7667) with master (0bde5ca)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@Tagar Tagar closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants