Investigate slow array-backed object access in jperl
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- performance
調査の方向性
Start with dev/bench/benchmark_method.pl and run the hash-backed and array-backed variants in fresh PerlOnJava processes, as described. Then profile the method-call workload and trace generated JVM code and runtime helpers for field reads and updates; compare JVM and interpreter backends. Done means the performance gap is localized, with a focused benchmark or regression check added and an optimization that preserves Perl semantics.
索引モデルが issue の本文から書いたものです。
説明
Summary
Investigate why array-backed objects are substantially slower than hash-backed objects in PerlOnJava for repeated method calls and field updates. The same benchmark shows a small array advantage in system Perl, so this appears to be a PerlOnJava implementation-path difference rather than an inherent cost of Perl array objects.
Reproduction
Run dev/bench/benchmark_method.pl, which performs 500 Benchmark iterations of a method called 20,000 times per iteration. Foo::add reads and increments $self->{x} and $self->{y}, then returns their sum.
For the array-backed variant, replace construction with bless [ 1, 2 ], $class, and change the field accesses to $self->[0] and $self->[1].
Both variants completed successfully and printed the same final value: done 399600080000.
Observed performance
Reported by Perl's Benchmark::timethis (iterations/second; larger is faster):
| Runtime | Hash-backed | Array-backed | Difference |
|---|---|---|---|
| System Perl | 329–330/s | 359–360/s | array ~9% faster |
PerlOnJava (jperl) |
264–268/s | 89–91/s | array ~66% slower |
The PerlOnJava result was repeated twice after the initial run and was consistent. Each PerlOnJava run was executed in a fresh process.
Investigation goals
- Profile the benchmark to separate method dispatch, argument setup, scalar arithmetic, hash access, and array access costs.
- Trace generated JVM code and runtime helpers for
$self->{key}versus$self->[index], including lvalue fetch/store paths. - Determine whether array access allocates or copies wrappers, performs redundant bounds/type checks, or takes a slower generic path.
- Compare JVM and interpreter backends to localize the issue.
- Add a focused benchmark or regression performance check once the hot path is understood, then optimize without changing Perl semantics.
Caveats
This is a microbenchmark of the complete method-call path, not an isolated container benchmark. The result does not prove hash access is optimal; it shows that this workload currently favors hash-backed objects in PerlOnJava. More controlled access-only benchmarks and profiling are needed before attributing the gap to a specific implementation component.
- 主要言語
- Perl
- スター
- 64
- フォーク
- 8
- 平均マージ
- 5時間 28分
- マージ済み PR(30日)
- 199
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fglock/PerlOnJava のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
fglock/PerlOnJava#1579 ·
メンテナーはふだん 1 日以内に返信
-
area:runtime bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
fglock/PerlOnJava#1859 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
fglock/PerlOnJava#1851 ·
メンテナーはふだん 1 日以内に返信
-
perf: close method-call throughput gap to blead Perl対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea:performance enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
fglock/PerlOnJava#1846 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
fglock/PerlOnJava#1835 ·
メンテナーはふだん 1 日以内に返信
fglock/PerlOnJava の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
radius_audit_logs/search returns 500 when the body has no query (nil SearchOp in Vars2.Sql)対応中かも @fdurand が 1 日前に担当しました。 オープンType: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
inverse-inc/packetfence#9564 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
LMS-Community/slimserver#1692 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(api): API v3 Product Read ignores request language (lc) for sample products and image URLs対応中かも @muntasir-396 が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openfoodfacts/openfoodfacts-server#15042 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信