From: ts Date: 2008-01-16T00:55:31+09:00 Subject: Re: Fwd: 1.9 significantly slower than 1.8 on Mac >>>>> "D" == Derek Chesterfield writes: D> So unless there is some internal optimisation that occurs when the D> block is removed, it looks like each_line is the problem, not Regexp??? Well, some part of #each_line for 1.8.6 for (s = p, p += rslen; p < pend; p++) { if (rslen == 0 && *p == '\n') { if (*++p != '\n') continue; while (*p == '\n') p++; } easy : increment p and test the same for 1.9 while (p < pend) { int c = rb_enc_codepoint(p, pend, enc); int n = rb_enc_codelen(c, enc); if (rslen == 0 && c == newline) { while (p < pend && rb_enc_codepoint(p, pend, enc) == newline) { p += n; } p -= n; } a little more complex : retrieve the code point retrieve its length etc, Guy Decoux