[#4745] Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...>

Having taken upon me the task to provide a Windows build for

24 messages 2005/04/20
[#4746] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Austin Ziegler <halostatue@...> 2005/04/20

On 4/20/05, Erik Huelsmann <ehuels@gmail.com> wrote:

[#4747] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/20

Hi Austin,

[#4762] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — nobu.nokada@... 2005/04/24

Hi,

[#4783] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/25

On 4/24/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:

[#4787] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — nobu.nokada@... 2005/04/25

Hi,

[#4794] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/25

> > > Ruby is just using AC_TYPE_UID_T. So, using typedef for them,

[#4751] Illegal regexp causes segfault — Andrew Walrond <andrew@...>

irb(main):058:0> a = /\[([^]]*)\]/

13 messages 2005/04/22

[PATCH] Trivial speedup in Array#zip

From: Mauricio Fern疣dez <batsman.geo@...>
Date: 2005-04-18 23:38:08 UTC
List: ruby-core #4736

Silly benchmark:

(2..7).each do |i|
    a = [10] * 10**i
    b = [20] * 10**i
    t = Time.new
    a.zip(b){|x,y|}
    puts "%9d: %8.5f" % [10**i, Time.new - t]
end

(you might also want to try a.zip(b){||} )

Results:

patched
batsman@tux-chan:/tmp/ruby$ ./ruby /tmp/bench.rb
      100:  0.00007
     1000:  0.00051
    10000:  0.00496
   100000:  0.06115
  1000000:  0.48373
 10000000:  4.71240

orig -> ruby 1.8.2 (2005-04-12) [i686-linux]
batsman@tux-chan:/tmp/ruby$ ruby /tmp/bench.rb
      100:  0.00010
     1000:  0.00077
    10000:  0.00941
   100000:  0.15001
  1000000:  4.45847
 10000000: 358.12643


Note that the difference would be larger if the environment were a bit
"heavier" (more live objects). Of course, it will be less important
for most realistic usages of #zip with non-empty blocks, but it's
nonetheless an overhead there's no reason to keep AFAIK.


Once the patch is applied, the temporary array used to hold the items
from the original arrays is allocated once; in the original code, it
would be discarded on each iteration and a new one would be allocated,
often triggering the GC...


--- array.c.orig        2005-04-18 00:11:33.000000000 +0200
+++ array.c     2005-04-18 00:22:18.000000000 +0200
@@ -2074,12 +2074,12 @@
        argv[i] = to_ary(argv[i]);
     }
     if (rb_block_given_p()) {
+        VALUE tmp = rb_ary_new2(argc+1);
+        RARRAY(tmp)->len = argc + 1;
        for (i=0; i<RARRAY(ary)->len; i++) {
-           VALUE tmp = rb_ary_new2(argc+1);
-
-           rb_ary_push(tmp, rb_ary_elt(ary, i));
+            RARRAY(tmp)->ptr[0] = RARRAY(ary)->ptr[i];
            for (j=0; j<argc; j++) {
-               rb_ary_push(tmp, rb_ary_elt(argv[j], i));
+                RARRAY(tmp)->ptr[1+j] = rb_ary_elt(argv[j], i);
            }
            rb_yield(tmp);
        }


-- 
Mauricio Fern疣dez

In This Thread

Prev Next