develooper Front page | perl.perl5.porters | Postings from May 2010

[perl #75254] Slow GC after Scalar::Util::weaken

Thread Next
From:
Юрий Малыхин
Date:
May 22, 2010 14:09
Subject:
[perl #75254] Slow GC after Scalar::Util::weaken
Message ID:
rt-3.6.HEAD-4976-1274483230-916.75254-75-0@perl.org
# New Ticket Created by  Юрий Малыхин 
# Please include the string:  [perl #75254]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=75254 >


This is a bug report for perl from jura05@jura05-desktop.nonet,
generated with the help of perlbug 1.39 running under perl 5.12.0.

I found that garbage collection after weakening is
extemely slow in some cases. Here is the code:

#!/usr/bin/perl -w use strict;
use Scalar::Util qw(weaken);

my @data = (1, 2, 3);
print time, " test 0: main start\n";
&gogogo();
print time, " test 3: main end\n";

sub gogogo {
    print time, " test 1: func start\n";
    my @h;
    for (1 .. 200000) {
        my %hash = (data => \@data);
        weaken($hash{data});
        push @h, \%hash;
    }
    print time, " test 2: func end\n"
; }


Timing:

1273747847 test 0: main start
1273747847 test 1: func start
1273747847 test 2: func end
1273747873 test 3: main end 

-----------------------------------------------------------------
[Please describe your issue here]



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.12.0:

Configured by jura05 at Sat May 22 02:10:50 MSD 2010.

Summary of my perl5 (revision 5 version 12 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=2.6.24-23-generic, archname=i686-linux
    uname='linux jura05-desktop 2.6.24-23-generic #1 smp mon jan 26 00:13:11 utc 2009 i686 gnulinux '
    config_args='-des -Dprefix=/home/jura05/localperl'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.2.4 (Ubuntu 4.2.4-1ubuntu3)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.7.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.7'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.12.0:
    /home/jura05/localperl/lib/site_perl/5.12.0/i686-linux
    /home/jura05/localperl/lib/site_perl/5.12.0
    /home/jura05/localperl/lib/5.12.0/i686-linux
    /home/jura05/localperl/lib/5.12.0
    .

---
Environment for perl 5.12.0:
    HOME=/home/jura05
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About