# Ruby-dev summary 28274-28333

**URL:** <https://www.ruby-forum.com/t/ruby-dev-summary-28274-28333/69275>\
**Category:** Ruby\
**Created:** [February 16, 2006, 4:58pm UTC](https://www.ruby-forum.com/t/ruby-dev-summary-28274-28333/69275 "2006-02-16T16:58:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kazuo\_Saito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ac8455/32.png) [@Kazuo\_Saito](https://www.ruby-forum.com/u/Kazuo_Saito)\
**Post date:** [February 16, 2006, 4:58pm UTC](https://www.ruby-forum.com/t/ruby-dev-summary-28274-28333/69275/1 "2006-02-16T16:58:45Z")

</div>

Hello all,

This is a summary of ruby-dev mailing list.

[ruby-dev:28290] [Oniguruma] Version 4.0.0

K.Kosako released the new version of Oniguruma. Matz imported  
the source into Ruby CVS repository.

The release has fixes for bug in handling comments in regexp,  
invalid error when compiling recursive regexp patterns, and  
optimization for regexps beginning with “.\*”.

[ruby-dev:28296] packing small Struct

Tanaka A. posted a patch for allocating small Struct  
objects with less memory consumption. It is useful for structs  
which has less than 3 elements in it, like cons cells. The  
patch packs the elements into the RStruct object itself like  
this patch for ruby.h:

+#define RSTRUCT\_EMBED\_LEN\_MAX 3  
struct RStruct {  
struct RBasic basic;

- long len;
- VALUE \*ptr;

- union {
- struct {
- 

```
  long len;

```

- 

```
  VALUE *ptr;

```

- } heap;
- VALUE ary[RSTRUCT\_EMBED\_LEN\_MAX];
- } as;  
};  
+#define RSTRUCT\_EMBED\_LEN\_MASK (FL\_USER1|FL\_USER0)  
+#define RSTRUCT\_EMBED\_LEN\_SHIFT FL\_USHIFT  
+#define RSTRUCT\_LEN(st) \
- ((RBASIC(st)-\>flags & RSTRUCT\_EMBED\_LEN\_MASK) ? \
- 

```
(RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & 3 : \

```

- 

```
RSTRUCT(st)->as.heap.len)

```

+#define RSTRUCT\_PTR(st) \

- ((RBASIC(st)-\>flags & RSTRUCT\_EMBED\_LEN\_MASK) ? \
- 

```
RSTRUCT(st)->as.ary : \

```

- 

```
RSTRUCT(st)->as.heap.ptr)

```

Tanaka said that the patch makes us to change all codes using  
“RSTRUCT(obj)-\>ptr” or “RSTRUCT(obj)-\>len” to use the macros  
above. But it was not so difficult because the change is simple,  
and it will be replaced automatically by editor or tools. Also,  
compiler can detect all unchanged codes. Hidetoshi Nagai agreed  
to change Ruby/Tk codes to fit the macros.  
At the end of the post, He added that the idea may be applicable  
for RString and RArray.

Matz accepted the patch and said that he have a similar idea for  
Values and other objects shorter than 11 bytes(12 bytes - NUL  
terminator). Tanaka-san showed us a profile for the length of  
String objects in Ruby interpreter at startup. According to  
reply from Matz, number of shorter objects seems to be increased  
when loading other libraries, rexml for example.

ruby-dev summary index:  
[http://i.loveruby.net/en/ruby-dev-summary.html](http://i.loveruby.net/en/ruby-dev-summary.html)
