Investigate slow array-backed object access in jperl
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 38/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Domínio
- performance
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Perl
- Estrelas
- 64
- Forks
- 8
- Merge médio
- 5h 42min
- PRs com merge (30d)
- 205
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de fglock/PerlOnJava
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
fglock/PerlOnJava#1579 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 20/100
fglock/PerlOnJava#1863 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area:memory area:performance area:runtime bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 52/100
fglock/PerlOnJava#1860 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 56/100
fglock/PerlOnJava#1851 ·
Mantenedores costumam responder em até 1 dia
-
area:performance enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
fglock/PerlOnJava#1846 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de fglock/PerlOnJava
Issues semelhantes
-
observablt-ci
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
elastic/golang-crossbuild#840 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
RotherOSS/otobo#6286 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
LMS-Community/slimserver#1692 · 6 comentários ·
Mantenedores costumam responder em até 1 dia
-
fix(api): API v3 Product Read ignores request language (lc) for sample products and image URLsTalvez já em andamento @muntasir-396 assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
openfoodfacts/openfoodfacts-server#15042 · 1 comentário ·
Mantenedores costumam responder em até 1 dia