Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infix eqv may hang when comparing equivalent recursive arrays #6272

Open
p6rt opened this issue May 26, 2017 · 4 comments
Open

infix eqv may hang when comparing equivalent recursive arrays #6272

p6rt opened this issue May 26, 2017 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 26, 2017

Migrated from rt.perl.org#131372 (status was 'open')

Searchable as RT131372$

@p6rt
Copy link
Author

p6rt commented May 26, 2017

From p.dumarchie@gmail.com

This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
implementing Perl 6.c.

The eqv implementation hangs when executing the following code​:

  my $a = [];
  $a[0] = $a;

  my $b = [];
  $b[0] = $b;

  $a eqv $b;

In the REPL a Ctrl-C won't terminate the evaluation. At first the memory
footprint of the moar process grows quickly, but over time the pace of
growth decreases while the CPU is kept busy.

It may be interesting to note that the eqv implementation does not hang
when the index of the recursive element in the two arrays is different. For
example, the following code just evaluates to True​:

  my $a = [];
  my $b = [];

  $a[0,1] = ($a, $b);
  $b[0,1] = ($a, $b);

  $a eqv $b;

while this hangs just like the simple example​:

  my $a = [];
  my $b = [];

  $a[0,1] = ($a, $b);
  $b[0,1] = ($b, $a);

  $a eqv $b;

@p6rt
Copy link
Author

p6rt commented May 28, 2017

From @lizmat

On 26 May 2017, at 12​:59, Peter du Marchie van Voorthuysen (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Peter du Marchie van Voorthuysen
# Please include the string​: [perl #​131372]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131372 >

This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
implementing Perl 6.c.

The eqv implementation hangs when executing the following code​:

my $a = [];
$a[0] = $a;

my $b = [];
$b[0] = $b;

$a eqv $b;

In the REPL a Ctrl-C won't terminate the evaluation. At first the memory
footprint of the moar process grows quickly, but over time the pace of
growth decreases while the CPU is kept busy.

This golfs to​:

my @​a = $(my @​b); @​b[0] = @​a; @​a eqv @​b

Same problem exists with hashes BTW​:

my %a = a => my %b; %b<a> = %a; %a eqv %b

Seems we need something like perlseen for eqv as well.

Looking at it now.

@p6rt
Copy link
Author

p6rt commented May 28, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 13, 2017

From p.dumarchie@gmail.com

This is Rakudo version 2017.07 built on MoarVM version 2017.07
implementing Perl 6.c.

The problem persists.

2017-05-28 20​:56 GMT+02​:00 Elizabeth Mattijsen via RT <
perl6-bugs-followup@​perl.org>​:

On 26 May 2017, at 12​:59, Peter du Marchie van Voorthuysen (via RT) <
perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Peter du Marchie van Voorthuysen
# Please include the string​: [perl #​131372]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131372 >

This is Rakudo version 2017.04.3 built on MoarVM version
2017.04-53-g66c6dda
implementing Perl 6.c.

The eqv implementation hangs when executing the following code​:

my $a = [];
$a[0] = $a;

my $b = [];
$b[0] = $b;

$a eqv $b;

In the REPL a Ctrl-C won't terminate the evaluation. At first the memory
footprint of the moar process grows quickly, but over time the pace of
growth decreases while the CPU is kept busy.

This golfs to​:

my @​a = $(my @​b); @​b[0] = @​a; @​a eqv @​b

Same problem exists with hashes BTW​:

my %a = a => my %b; %b<a> = %a; %a eqv %b

Seems we need something like perlseen for eqv as well.

Looking at it now.

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant