Reduce argument-container cleanup cost in call-heavy Perl code
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- backend, performance
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Perl
- Sterne
- 67
- Forks
- 9
- Ø Merge
- 6 Std. 45 Min.
- Gemergte PRs (30 T.)
- 104
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus fglock/PerlOnJava
-
area:cpan-port area:performance bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
fglock/PerlOnJava#2230 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:runtime documentation enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
fglock/PerlOnJava#1579 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:backend area:cpan-port area:runtime bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 72/100
fglock/PerlOnJava#2231 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:parser area:runtime area:unicode bug
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
fglock/PerlOnJava#2228 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:cpan-port area:runtime bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
fglock/PerlOnJava#2227 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in fglock/PerlOnJava
Ähnliche Issues
-
[doc] perlsub wrongly says that `"sub { ... }" creates a new subroutine each time it is executed'Offendocumentation Needs Triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
Maintainer antworten meist innerhalb von 1 Tag
-
docs(api): /api/v3/external_sources spec is missing lc and section_titleEvtl. vergeben @subhwastaken hat das heute übernommen. Offen
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 82/100
openfoodfacts/openfoodfacts-server#15626 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 67/100
LMS-Community/slimserver#1742 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
brucemiller/LaTeXML#2894 ·