<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/ext/json/parser, branch ruby_3_0</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[json] Make json Ractor safe</title>
<updated>2020-12-21T13:10:43+00:00</updated>
<author>
<name>Kenta Murata</name>
<email>mrkn@mrkn.jp</email>
</author>
<published>2020-12-21T06:57:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=14d7d1df25bbefadfc385042d541b4afc31e4c1b'/>
<id>14d7d1df25bbefadfc385042d541b4afc31e4c1b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[json] JSON_parse_float: Fix how to convert number</title>
<updated>2020-12-21T13:10:43+00:00</updated>
<author>
<name>Kenta Murata</name>
<email>mrkn@mrkn.jp</email>
</author>
<published>2020-12-21T06:50:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4c2e7f26bda8df087a66e546744de0d0d467ea7c'/>
<id>4c2e7f26bda8df087a66e546744de0d0d467ea7c</id>
<content type='text'>
Stop BigDecimal-specific optimization.  Instead, it tries the conversion
methods in the following order:

1. `try_convert`,
2. `new`, and
3. class-named function, e.g. `Foo::Bar.Baz` function for `Foo::Bar::Baz` class

If all the above candidates are unavailable, it fallbacks to Float.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Stop BigDecimal-specific optimization.  Instead, it tries the conversion
methods in the following order:

1. `try_convert`,
2. `new`, and
3. class-named function, e.g. `Foo::Bar.Baz` function for `Foo::Bar::Baz` class

If all the above candidates are unavailable, it fallbacks to Float.
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement a freeze: parser option</title>
<updated>2020-10-20T12:40:25+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2020-09-09T13:24:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=520e0916af0fe53a5ca57269a2bae50cc60e4241'/>
<id>520e0916af0fe53a5ca57269a2bae50cc60e4241</id>
<content type='text'>
If set to true all parsed objects will be
immediately frozen, and strings will be
deduplicated if the Ruby implementation
allows it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If set to true all parsed objects will be
immediately frozen, and strings will be
deduplicated if the Ruby implementation
allows it.
</pre>
</div>
</content>
</entry>
<entry>
<title>sed -i '/rmodule.h/d'</title>
<updated>2020-08-27T07:42:06+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2020-07-22T06:40:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=490010084ed09d9825e8d9198a02b930eaa1cd85'/>
<id>490010084ed09d9825e8d9198a02b930eaa1cd85</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>sed -i '/r_cast.h/d'</title>
<updated>2020-08-27T06:03:36+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2020-07-22T05:47:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=756403d775c7d7d60da179dd9b788d63e72c77ab'/>
<id>756403d775c7d7d60da179dd9b788d63e72c77ab</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>sed -i '\,2/extern.h,d'</title>
<updated>2020-08-27T05:07:49+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2020-07-21T06:35:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0da2a3f1fc22da47cdce3cbcd8031d609ba8f207'/>
<id>0da2a3f1fc22da47cdce3cbcd8031d609ba8f207</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[flori/json] Use frozen string for hash key</title>
<updated>2020-07-01T09:47:51+00:00</updated>
<author>
<name>Watson</name>
<email>watson1978@gmail.com</email>
</author>
<published>2018-02-27T13:40:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cb3e62511c7c7a7d568342d82b641e491ce589e1'/>
<id>cb3e62511c7c7a7d568342d82b641e491ce589e1</id>
<content type='text'>
When use non-frozen string for hash key with `rb_hash_aset()`, it will duplicate and freeze it internally.
To avoid duplicate and freeze, this patch will give a frozen string in `rb_hash_aset()`.

```
Warming up --------------------------------------
                json    14.000  i/100ms
Calculating -------------------------------------
                json    148.844  (± 1.3%) i/s -    756.000  in   5.079969s
```

```
Warming up --------------------------------------
                json    16.000  i/100ms
Calculating -------------------------------------
                json    165.608  (± 1.8%) i/s -    832.000  in   5.025367s
```

```
require 'json'
require 'securerandom'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj &lt;&lt; {
    "id": i,
    "uuid": SecureRandom.uuid,
    "created_at": Time.now
  }
end

json = obj.to_json

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count &lt; iter
      JSON.parse(json)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/18292c0c1d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When use non-frozen string for hash key with `rb_hash_aset()`, it will duplicate and freeze it internally.
To avoid duplicate and freeze, this patch will give a frozen string in `rb_hash_aset()`.

```
Warming up --------------------------------------
                json    14.000  i/100ms
Calculating -------------------------------------
                json    148.844  (± 1.3%) i/s -    756.000  in   5.079969s
```

```
Warming up --------------------------------------
                json    16.000  i/100ms
Calculating -------------------------------------
                json    165.608  (± 1.8%) i/s -    832.000  in   5.025367s
```

```
require 'json'
require 'securerandom'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj &lt;&lt; {
    "id": i,
    "uuid": SecureRandom.uuid,
    "created_at": Time.now
  }
end

json = obj.to_json

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count &lt; iter
      JSON.parse(json)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/18292c0c1d
</pre>
</div>
</content>
</entry>
<entry>
<title>ext/json/parser/prereq.mk: remove type-limit warning if char is unsigned</title>
<updated>2020-05-13T15:44:35+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2020-05-13T15:44:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8bd27c547c3260ce72dc5edbab248bb858c84cf2'/>
<id>8bd27c547c3260ce72dc5edbab248bb858c84cf2</id>
<content type='text'>
Ragel generates a code `0 &lt;= (*p)` where `*p` is char.
As char is unsigned by default on arm and RISC-V, it is warned by gcc:

```
compiling parser.c
parser.c: In function ‘JSON_parse_string’:
parser.c:1566:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
  ^
parser.c:1596:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
  ^
```

This change removes the warning by substituting the condition with
`0 &lt;= (signed char)(*p)`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ragel generates a code `0 &lt;= (*p)` where `*p` is char.
As char is unsigned by default on arm and RISC-V, it is warned by gcc:

```
compiling parser.c
parser.c: In function ‘JSON_parse_string’:
parser.c:1566:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
  ^
parser.c:1596:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  if ( 0 &lt;= (*p) &amp;&amp; (*p) &lt;= 31 )
  ^
```

This change removes the warning by substituting the condition with
`0 &lt;= (signed char)(*p)`.
</pre>
</div>
</content>
</entry>
<entry>
<title>sed -i 's|ruby/impl|ruby/internal|'</title>
<updated>2020-05-11T00:24:08+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2020-05-08T09:31:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9e41a75255d15765648279629fd3134cae076398'/>
<id>9e41a75255d15765648279629fd3134cae076398</id>
<content type='text'>
To fix build failures.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To fix build failures.
</pre>
</div>
</content>
</entry>
<entry>
<title>sed -i s|ruby/3|ruby/impl|g</title>
<updated>2020-05-11T00:24:08+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2020-05-04T06:35:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d7f4d732c199df24620a162372c71ee83ed21e62'/>
<id>d7f4d732c199df24620a162372c71ee83ed21e62</id>
<content type='text'>
This shall fix compile errors.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This shall fix compile errors.
</pre>
</div>
</content>
</entry>
</feed>
