in reply to Re^6: sorting two arrays together
in thread sorting two arrays together

Sure:

$ perl -V Summary of my perl5 (revision 5 version 10 subversion 1) configuration +: Platform: osname=linux, osvers=2.6.24-24-generic, archname=x86_64-linux-thre +ad-multi uname='linux tofana 2.6.24-24-generic #1 smp fri jul 24 22:15:50 u +tc 2009 x86_64 gnulinux ' config_args='-Dusethreads' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing + -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_ +FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -f +stack-protector -I/usr/local/include' ccversion='', gccversion='4.2.4 (Ubuntu 4.2.4-1ubuntu3)', gccosand +vers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -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 -fstac +k-protector' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_ +BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Mar 26 2010 08:03:08 @INC: /usr/local/lib/perl5/5.10.1/x86_64-linux-thread-multi /usr/local/lib/perl5/5.10.1 /usr/local/lib/perl5/site_perl/5.10.1/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.1 .

(If you need more info, or want me to try out some modification or something, just ask...)

Replies are listed 'Best First'.
Re^8: sorting two arrays together
by BrowserUk (Patriarch) on Dec 23, 2010 at 01:37 UTC

    If you have a 32-bit version of perl available, the results of the same 0.71/0.72 comparison would be interesting.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      32-bit versions1 seem to be ok.  Both 0.71 and 0.72 print (consistently):

      9175224 4194672

      While I was at it, I also tried a few more 64-bit versions on other machines (5.10.0, 5.10.1, 5.12.22). All exhibited the same wonkiness mentioned earlier. So it clearly seems to be a 64-bit incompatibility.

      Two more notes:

      (1)  In your Makefile.PL you have a line

      LIBS => $Config{cc} eq 'gcc' || $Config{cc} eq 'cc' ? ['-lstdc++'] : + '',

      With some of the perls I had tried, $Config{cc} was set to an absolute path '/usr/local/bin/gcc', or to 'gcc ' (yes, with a trailing space - not sure where this came from, I didn't knowingly put it there). So, your check didn't match, and libstdc++ wasn't linked in, which in turn led to the usual undefined reference to '__gxx_personality_v0' when Dynaloader tried to load the .so file.

      Something like the following might be slightly more robust:

      LIBS => $Config{cc} =~ /\bg?cc\s*$/ ? ['-lstdc++'] : '',

      (2)  When trying to build Devel-Size-0.72 for 5.12.2 with a more recent and picky gcc (v4.3.2), I got the following errors:

      Size.xs: In function 'UV thing_size(const SV*, char* (*)[8192])': Size.xs:552: error: invalid conversion from 'const void*' to 'void*' Size.xs:553: error: invalid conversion from 'const void*' to 'void*' Size.xs:554: error: invalid conversion from 'const void*' to 'void*' make: *** [Size.o] Error 1

      Explicitly casting thing to non-const void* 'fixed' it:

      /* Is there something hanging off the arylen element? */ if (AvARYLEN((void*)thing)) { if (check_new(tv, AvARYLEN((void*)thing))) { total_size += thing_size(AvARYLEN((void*)thing), tv);

      __________

      And here the 'perl -V's, just in case:

      1)

      2)

        64-bit bug now fixed and will be on CPAN once I've had it tested on *nix and regression on 32-bit builds.

        c:\test>perl -MDevel::Size71=total_size -E"$a[$_]=1 for 1..1e6; say total_size( \@a )" 32388768 c:\test>perl -MDevel::Size=total_size -E"$a[$_]=1 for 1..1e6; say total_size( \@a )" 32388768 c:\test>perl -MDevel::Size71=total_size -E"$a[$_]=[1,1] for 1..5e5; say total_size( \@a )" 104194464 c:\test>perl -MDevel::Size=total_size -E"$a[$_]=[1,1] for 1..5e5; say total_size( \@a )" 104194464

        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.