[#118180] [Ruby master Bug#20525] Percent string literal with indentation support — "bradgessler (Brad Gessler) via ruby-core" <ruby-core@...>

Issue #20525 has been reported by bradgessler (Brad Gessler).

8 messages 2024/06/04

[#118243] [Ruby master Feature#20564] Switch default parser to Prism — "kddnewton (Kevin Newton) via ruby-core" <ruby-core@...>

Issue #20564 has been reported by kddnewton (Kevin Newton).

11 messages 2024/06/07

[#118269] [Ruby master Bug#20570] Nokey behavior changed since 3.3. — "ksss (Yuki Kurihara) via ruby-core" <ruby-core@...>

Issue #20570 has been reported by ksss (Yuki Kurihara).

8 messages 2024/06/10

[#118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings — "tenderlovemaking (Aaron Patterson) via ruby-core" <ruby-core@...>

Issue #20573 has been reported by tenderlovemaking (Aaron Patterson).

10 messages 2024/06/10

[#118281] [Ruby master Misc#20574] DevMeeting-2024-07-11 — "mame (Yusuke Endoh) via ruby-core" <ruby-core@...>

Issue #20574 has been reported by mame (Yusuke Endoh).

12 messages 2024/06/11

[#118346] [Ruby master Bug#20586] Some filesystem calls in dir.c are missing error handling and can return incorrect results if interrupted — "ivoanjo (Ivo Anjo) via ruby-core" <ruby-core@...>

Issue #20586 has been reported by ivoanjo (Ivo Anjo).

13 messages 2024/06/19

[#118347] [Ruby master Bug#20587] dir.c calls blocking system calls while holding the GVL — "ivoanjo (Ivo Anjo) via ruby-core" <ruby-core@...>

Issue #20587 has been reported by ivoanjo (Ivo Anjo).

7 messages 2024/06/19

[#118360] [Ruby master Bug#20588] RangeError: integer 132186463059104 too big to convert to 'int' since cdf33ed5f37f9649c482c3ba1d245f0d80ac01ce with YJIT enabled — "yahonda (Yasuo Honda) via ruby-core" <ruby-core@...>

Issue #20588 has been reported by yahonda (Yasuo Honda).

10 messages 2024/06/20

[#118388] [Ruby master Feature#20594] A new String method to append bytes while preserving encoding — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>

SXNzdWUgIzIwNTk0IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGJ5cm9vdCAoSmVhbiBCb3Vzc2llciku

32 messages 2024/06/25

[ruby-core:118309] [Ruby master Feature#20576] Add MatchData#bytebegin and MatchData#byteend

From: "shugo (Shugo Maeda) via ruby-core" <ruby-core@...>
Date: 2024-06-13 00:51:46 UTC
List: ruby-core #118309
Issue #20576 has been updated by shugo (Shugo Maeda).


Eregon (Benoit Daloze) wrote in #note-1:
> Does this difference matter in realistic usages (e.g. that net-imap one)?=
 How much improvement is it there?

I guess the diffrence doesn't matter so much compared to I/O etc, but it's =
frustrating to write code like `$~.byteoffset(0)[1]` when only the end offs=
et is needed.

> Regarding naming, `byteend` seems hard to read, I think `byte_begin`/`byt=
e_end` is much clearer.

I proposed `byteend` for consistency with existing methods such as byteoffs=
et.
If we choose `byte_end`, it may be better to introduce new aliases for such=
 existing methods.


----------------------------------------
Feature #20576: Add MatchData#bytebegin and MatchData#byteend
https://bugs.ruby-lang.org/issues/20576#change-108816

* Author: shugo (Shugo Maeda)
* Status: Open
* Target version: 3.4
----------------------------------------
I'd like to propose MatchData#bytebegin and MatchData#byteend.
These methods are similar to MatchData#begin and MatchData#end, but returns=
 offsets in bytes instead of codepoints.

Pull request: https://github.com/ruby/ruby/pull/10973

One of the use cases is scanning strings: https://github.com/ruby/net-imap/=
pull/286/files
MatchData#byteend is faster than MatchData#byteoffset because there is no n=
eed to allocate an Array.
Here's a benchmark result:

```
voyager:ruby$ cat b.rb=20
require "benchmark"
require "strscan"

text =3D "=E3=81=82" * 100000

Benchmark.bmbm do |b|
  b.report("byteoffset(0)[1]") do
    pos =3D 0
    while text.byteindex(/\G./, pos)
      pos =3D $~.byteoffset(0)[1]
    end
  end

  b.report("byteend(0)") do
    pos =3D 0
    while text.byteindex(/\G./, pos)
      pos =3D $~.byteend(0)
    end
  end
end
voyager:ruby$ ./tool/runruby.rb b.rb          =20
Rehearsal ----------------------------------------------------
byteoffset(0)[1]   0.020558   0.000393   0.020951 (  0.020963)
byteend(0)         0.018149   0.000000   0.018149 (  0.018151)
------------------------------------------- total: 0.039100sec

                       user     system      total        real
byteoffset(0)[1]   0.020821   0.000000   0.020821 (  0.020822)
byteend(0)         0.017455   0.000000   0.017455 (  0.017455)
```




--=20
https://bugs.ruby-lang.org/

In This Thread