Skip to content

parsing slowdown with new features in 1.281 #309

@mtths

Description

@mtths

we saw quite a slowdown in parsing times with the latest PPI, especially in our fatter modules (up to a factor of 20)

the slowdown seems to occur in parsing the document during object creation. method calls on the parsed document have similar call times as before

  $ perl -MPPI -E 'warn PPI->VERSION'
  1.281 at -e line 1.
  $ /tmp/ppi_test.pl "/opt/perl-current-live/local-default/lib/perl5/CGI.pm"
  loaded in 4.34172 at /tmp/ppi_test.pl line 10.
  complete 1 in 0.05063 at /tmp/ppi_test.pl line 14.
  incl 19 in 0.04981 at /tmp/ppi_test.pl line 18.
  $
  $ ## after PPI downgrade
  $ perl -MPPI -E 'warn PPI->VERSION'
  1.279 at -e line 1.
  $ /tmp/ppi_test.pl "/opt/perl-current-live/local-default/lib/perl5/CGI.pm"
  loaded in 0.82833 at /tmp/ppi_test.pl line 10.
  complete 1 in 0.04924 at /tmp/ppi_test.pl line 14.
  incl 19 in 0.05106 at /tmp/ppi_test.pl line 18.
  $
  $ cat /tmp/ppi_test.pl
  #!/usr/bin/env perl

  use v5.40;
  use PPI;
  use Time::HiRes qw/time/;

  my $t0 = time;
  my $p = PPI::Document->new(shift)
      or die "couldnt load";
  warn sprintf("loaded in %.5f", time - $t0);

  $t0 = time;
  my $ok = $p->complete;
  warn sprintf("complete %s in %.5f", $ok, time - $t0);

  $t0 = time;
  my $incl = $p->find("PPI::Statement::Include");
  warn sprintf("incl %s in %.5f", scalar @$incl, time - $t0);

  $

we use PPI for checking syntax and via perlcritic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions