<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/-ext-/string/test_capacity.rb, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Decouple GC slot sizes from RVALUE</title>
<updated>2022-02-02T14:52:04+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-02-01T14:25:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7b77d46671685c837adc33b39ae0210e04cd8b24'/>
<id>7b77d46671685c837adc33b39ae0210e04cd8b24</id>
<content type='text'>
Add a new macro BASE_SLOT_SIZE that determines the slot size.

For Variable Width Allocation (compiled with USE_RVARGC=1), all slot
sizes are powers-of-2 multiples of BASE_SLOT_SIZE.

For USE_RVARGC=0, BASE_SLOT_SIZE is set to sizeof(RVALUE).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a new macro BASE_SLOT_SIZE that determines the slot size.

For Variable Width Allocation (compiled with USE_RVARGC=1), all slot
sizes are powers-of-2 multiples of BASE_SLOT_SIZE.

For USE_RVARGC=0, BASE_SLOT_SIZE is set to sizeof(RVALUE).
</pre>
</div>
</content>
</entry>
<entry>
<title>Make embedded string length a long for VWA</title>
<updated>2022-01-12T17:00:55+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-01-11T20:19:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2d81a718eca679b9bf458beccf1e7a86b812c3e2'/>
<id>2d81a718eca679b9bf458beccf1e7a86b812c3e2</id>
<content type='text'>
A short (2 bytes) will cause unaligned struct accesses when strings are
used as a buffer to directly store binary data.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A short (2 bytes) will cause unaligned struct accesses when strings are
used as a buffer to directly store binary data.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #18239] Implement VWA for strings</title>
<updated>2021-10-25T17:26:23+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2021-08-26T14:06:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a5b6598192c30187b19b892af3110a46f6a70d76'/>
<id>a5b6598192c30187b19b892af3110a46f6a70d76</id>
<content type='text'>
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[EXPERIMENTAL] Make Symbol#to_s return a frozen String [Feature #16150]"</title>
<updated>2019-11-05T08:30:54+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2019-11-05T08:30:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bea322a352d820007dd4e6cab88af5de01854736'/>
<id>bea322a352d820007dd4e6cab88af5de01854736</id>
<content type='text'>
This reverts commit 6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e.
</pre>
</div>
</content>
</entry>
<entry>
<title>[EXPERIMENTAL] Make Symbol#to_s return a frozen String</title>
<updated>2019-09-26T08:23:02+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2019-09-08T09:53:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e'/>
<id>6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e</id>
<content type='text'>
* Always the same frozen String for a given Symbol.
* Avoids extra allocations whenever calling Symbol#to_s.
* See [Feature #16150]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Always the same frozen String for a given Symbol.
* Avoids extra allocations whenever calling Symbol#to_s.
* See [Feature #16150]
</pre>
</div>
</content>
</entry>
<entry>
<title>Resize capacity for fstring</title>
<updated>2019-06-26T06:01:48+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2019-06-25T16:01:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=04bc4c0662344238a556aa92f5f8f6d42586bab3'/>
<id>04bc4c0662344238a556aa92f5f8f6d42586bab3</id>
<content type='text'>
When a string is #frozen, it's capacity is resized to fit (if it is much
larger), since we know it will no longer be mutated.

    &gt; puts ObjectSpace.dump(String.new("a"*30, capacity: 1000))
    {"type":"STRING", "class":"0x7feaf00b7bf0", "bytesize":30, "capacity":1000, "value":"...
    &gt; puts ObjectSpace.dump(String.new("a"*30, capacity: 1000).freeze)
    {"type":"STRING", "class":"0x7feaf00b7bf0", "frozen":true, "bytesize":30, "value":"...

(ObjectSpace.dump doesn't show capacity if capacity is equal to bytesize)

Previously, if we dedup into an fstring, using String#-@, capacity would
not be reduced.

    &gt; puts ObjectSpace.dump(-String.new("a"*30, capacity: 1000))
    {"type":"STRING", "class":"0x7feaf00b7bf0", "frozen":true, "fstring":true, "bytesize":30, "capacity":1000, "value":"...

This commit makes rb_fstring call rb_str_resize, the same as
rb_str_freeze does.

Closes: https://github.com/ruby/ruby/pull/2256
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a string is #frozen, it's capacity is resized to fit (if it is much
larger), since we know it will no longer be mutated.

    &gt; puts ObjectSpace.dump(String.new("a"*30, capacity: 1000))
    {"type":"STRING", "class":"0x7feaf00b7bf0", "bytesize":30, "capacity":1000, "value":"...
    &gt; puts ObjectSpace.dump(String.new("a"*30, capacity: 1000).freeze)
    {"type":"STRING", "class":"0x7feaf00b7bf0", "frozen":true, "bytesize":30, "value":"...

(ObjectSpace.dump doesn't show capacity if capacity is equal to bytesize)

Previously, if we dedup into an fstring, using String#-@, capacity would
not be reduced.

    &gt; puts ObjectSpace.dump(-String.new("a"*30, capacity: 1000))
    {"type":"STRING", "class":"0x7feaf00b7bf0", "frozen":true, "fstring":true, "bytesize":30, "capacity":1000, "value":"...

This commit makes rb_fstring call rb_str_resize, the same as
rb_str_freeze does.

Closes: https://github.com/ruby/ruby/pull/2256
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixed misspelling words.</title>
<updated>2017-10-22T11:27:06+00:00</updated>
<author>
<name>hsbt</name>
<email>hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-10-22T11:27:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6693e3e7230ca64b01ffb24d2693af1c77bd2998'/>
<id>6693e3e7230ca64b01ffb24d2693af1c77bd2998</id>
<content type='text'>
  These are detected by https://github.com/client9/misspell

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  These are detected by https://github.com/client9/misspell

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>io.c: shrink read buffer</title>
<updated>2017-08-31T08:21:46+00:00</updated>
<author>
<name>nobu</name>
<email>nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-08-31T08:21:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9f1994ed5ce9e5f3a0964058b4753a021a92e40d'/>
<id>9f1994ed5ce9e5f3a0964058b4753a021a92e40d</id>
<content type='text'>
* io.c (io_setstrbuf): return true if the buffer is newly created.

* io.c (io_set_read_length): shrink the read buffer if it is a new
  object and is too large.  [ruby-core:81370] [Bug #13597]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* io.c (io_setstrbuf): return true if the buffer is newly created.

* io.c (io_set_read_length): shrink the read buffer if it is a new
  object and is too large.  [ruby-core:81370] [Bug #13597]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>* string.c (rb_str_init): introduce String.new(capacity: size)</title>
<updated>2016-02-17T03:21:35+00:00</updated>
<author>
<name>naruse</name>
<email>naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2016-02-17T03:21:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d46e2aea718920f535c1dc701cbd6b85a8e1fcac'/>
<id>d46e2aea718920f535c1dc701cbd6b85a8e1fcac</id>
<content type='text'>
  [Feature #12024]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  [Feature #12024]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>* test/-ext-/string/test_capacity.rb: Added missing library.</title>
<updated>2016-01-27T12:04:47+00:00</updated>
<author>
<name>hsbt</name>
<email>hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2016-01-27T12:04:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b7b5692aea3e1db3dfefb2e05fbc564235f09a63'/>
<id>b7b5692aea3e1db3dfefb2e05fbc564235f09a63</id>
<content type='text'>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
</feed>
