Reduce argument-container cleanup cost in call-heavy Perl code
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Start with the call-frame cleanup in src/main/java/org/perlonjava/runtime/runtimetypes/RuntimeCode.java, then trace the cell visits in RuntimeArray.java and owner reconciliation in RuntimeScalar.java. Read the existing tests around argument containers, ownership, aliasing, and destruction, and add deterministic coverage for repeated calls with shift. Done means the requested backend checks and matched current-parent versus candidate measurements pass, and the unchanged Math-Gauss suite completes without the observed delay.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Math-Gauss 0.01's t/Math-Gauss.t passes under standard Perl but exceeds the PerlOnJava CPAN test timeout. A bounded reproduction and two live JVM thread samples point to high CPU cost in per-call argument-container ownership cleanup: releasing a Perl argument container reconciles its cells, and argument extraction also exercises the same container-owner bookkeeping. This is a performance failure, not evidence of non-termination.
Evidence
- CPAN random-tester run:
20261129-192130-74689; targetMath::Gauss; distributionMath-Gauss-0.01; testt/Math-Gauss.t. - The archived run record reports
TIMEOUT (soft limit 240s exceeded; no output for 232s)while invoking the test harness. The harness reports the test file only after that file completes, so the absence of intermediate TAP is expected. - The paired standard-Perl oracle used Perl 5.42.2 and passed the complete suite: 1 file / 101 tests, 0.52 CPU seconds.
- A faithful bounded rerun with PerlOnJava 5.44.1, Temurin 24.0.2, macOS arm64, source commit
574e32db7c29483f366d6b1b608b88eb39e8af28ran for 300 seconds and exited 124 with no test output. The target JVM sustained approximately one CPU core. Other CPAN work was active on the shared host during this rerun, so the elapsed time is not a clean benchmark; it does reproduce the CPU-bound timeout behavior. - The test's two numerical comparison loops each have 244,610 parameter combinations. Across both loops, the test makes about 1.96 million Perl subroutine calls to
pdf,cdf, andalmost;cdfcallspdf, andpdf/cdfconsume arguments withshift. - At about 58 seconds, a live JVM stack was in
RuntimeArray.shift→RuntimeArrayElementList.removeFirst→RuntimeScalar.reconcileContainerOwnerAfterMutation. - At about 93 seconds, a second stack was in
RuntimeCode.popArgs→releaseArgumentContainerOwners→ArgumentContainerOwner.release→refreshUntrackedCellsAfterContainerTransfer→RuntimeArray.refreshUntrackedElementOwnersAfterTransfer→RuntimeScalar.reconcileContainerOwnerAfterAggregateTransfer/removeContainerOwnerTracking. The stack entered throughBytecodeInterpreter.execute. - The relevant cleanup remains present on live master
f5352bb8d2e34dd6ad2d3bc0bd73818d250f8346:RuntimeCodereleases the argument-container owner and refreshes its cells;RuntimeArrayvisits each direct cell;RuntimeScalarreconciles ownership and searches for replacement owners.RuntimeCode.popArgsreleases these owners on call-frame exit.
The exact CPAN reproduction was run on 574e32db7c, not again on the latest f5352bb8d2 master artifact. The source inspection confirms the implicated path still exists there. A parent-versus-current performance comparison and a forced interpreter-only comparison remain undone.
Suspected cause
Call-frame teardown repeatedly reconciles argument-array cells even in a workload dominated by short-lived calls and shift-based argument extraction. That path performs container membership and owner-ledger work for each affected scalar; at this call volume, the bookkeeping dominates the small Gaussian formulas. The thread samples support this cause, but a profile with inclusive/exclusive costs and deterministic work counters should guide the fix.
Related: #1863 tracks project-wide throughput work. Its current scope does not record this argument-container cleanup path or the Math-Gauss workload. Issues #1860 and #1950 concern different reachability-walk paths. PR #1938 merged the explicit-owner migration; this report describes the still-present call-cleanup cost and does not claim that PR alone introduced it.
Acceptance criteria
- Add deterministic coverage or counters for argument-container cleanup under repeated calls and
shift; assert redundant reconciliation/work is bounded without using elapsed time as a test assertion. - Validate any Perl-level regression with standard Perl first, then run focused coverage on JVM and interpreter while preserving argument aliasing, owner release, weak-reference, and destruction behavior.
- Rerun the unchanged
Math-Gauss-0.01suite on current master and the fixed candidate. Record both backends and bounded outcomes; the suite should complete without the observed multi-minute CPU-bound delay. - Capture CPU/allocation evidence and a matched current-parent versus candidate timing with equal work and checksums. Do not claim a general speedup from this single CPAN workload.
- Ngôn ngữ chính
- Perl
- Star
- 67
- Fork
- 9
- Merge trung bình
- 6 giờ 45 phút
- Pull request đã merge (30 ngày)
- 104
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fglock/PerlOnJava
-
area:cpan-port area:performance bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fglock/PerlOnJava#2230 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime documentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fglock/PerlOnJava#1579 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:backend area:cpan-port area:runtime bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 72/100
fglock/PerlOnJava#2231 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:parser area:runtime area:unicode bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
fglock/PerlOnJava#2228 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port area:runtime bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
fglock/PerlOnJava#2227 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fglock/PerlOnJava
Issue tương tự
-
[doc] perlsub wrongly says that `"sub { ... }" creates a new subroutine each time it is executed'Đang mởdocumentation Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs(api): /api/v3/external_sources spec is missing lc and section_titleCó thể đã có người làm @subhwastaken đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
openfoodfacts/openfoodfacts-server#15626 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 67/100
LMS-Community/slimserver#1742 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
brucemiller/LaTeXML#2894 ·