Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Investigate slow array-backed object access in jperl

Abierto
#1,854 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
38/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java, perl
Área
performance

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Perl
Estrellas
64
Forks
8
Merge medio
5 h 42 min
PR fusionados (30 d)
205

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de fglock/PerlOnJava

Todos los issues de fglock/PerlOnJava

Issues similares

Más issues de Perl

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.