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

I don't trust Devel::Size, I prefer measuring externally:
my @a; my @b; for (0 .. 2 ** 16 - 1) { if ($ARGV[0]) { $a[$_][0] = $_; $a[$_][1] = $_; } else { @a[$_] = $_; @b[$_] = $_; } } system "grep ^VmSize /proc/$$/status"; __END__
Without an argument, I get VmSize: 11460 kB, with an argument I get VmSize: 16636 kB. Repeated runs vary by less than 10 kB. That's a difference of 45%.

However, I do notice a difference using total_size as well. Adding a say total_size(\@a) + total_size(\@b); at the end, I get:

VmSize: 11844 kB 3670208
and
VmSize: 16996 kB 10748112
Almost 3 times the amount of memory with array pairs than without, according to Devel::Size;

Replies are listed 'Best First'.
Re^5: sorting two arrays together
by Anonyrnous Monk (Hermit) on Dec 23, 2010 at 00:11 UTC

    Just tried again with the Devel::Size version 0.71. With this I get (which makes more sense):

    15204688 # pairs 7340704 # 2 arrays

    The randomness in the results is also gone.

    I was using BrowserUk's patched version 0.72, which I thought fixed some issues he had discovered with the 'official' version — apparently there are other issues...

      I was using BrowserUk's patched version 0.72,

      Could you post your platform/version details please.


      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.

        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...)