Граф коммитов

230 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA a09c3c6fe1
expand VERSION path for ruby repository. 2020-12-17 14:37:45 +09:00
Hiroshi SHIBATA 46ea74297e
Bump version to json-2.4.1 and use VERSION file for json version same as upstream 2020-12-17 14:20:42 +09:00
Hiroshi SHIBATA ad3e3bd65a
Bump version to json-2.4.0 2020-12-15 19:54:58 +09:00
Hiroshi SHIBATA 17e7a819f7 Complex and Rational is embedded classes now 2020-11-10 13:14:42 +09:00
Jean Boussier 520e0916af
Implement a freeze: parser option
If set to true all parsed objects will be
immediately frozen, and strings will be
deduplicated if the Ruby implementation
allows it.
2020-10-20 21:40:25 +09:00
Jean Boussier 927a377a7c [flori/json] Fix JSON.load_file doc
https://github.com/flori/json/commit/cb61a00ba8
2020-09-25 17:28:42 +09:00
BurdetteLamar 038252fe66 [flori/json] Partial compliance with doc/method_documentation.rdoc
https://github.com/flori/json/commit/6dfa885134
2020-09-25 17:28:42 +09:00
Burdette Lamar 71f64e15b9 [flori/json] Enhanced RDoc for JSON.dump (#443)
* Enhanced RDoc for JSON.dump
https://github.com/flori/json/commit/03f1699ec4
2020-09-25 17:28:42 +09:00
Julien Feltesse 3d5e833998 bundle the LICENSE file in the gem 2020-09-25 17:28:42 +09:00
BurdetteLamar de0e0ffad4 [flori/json] Nodoc for recurse_proc
https://github.com/flori/json/commit/f8c0fe2408
2020-09-25 17:28:42 +09:00
BurdetteLamar e9096f796c [flori/json] RDoc for JSON.load with proc
https://github.com/flori/json/commit/a55c91934e
2020-09-25 17:28:42 +09:00
Karol Bucek f8d43e5370 unify json-java gemspec with the baseline 2020-09-25 17:28:42 +09:00
BurdetteLamar 8c057bb845 [flori/json] RDoc example for JSON.load
https://github.com/flori/json/commit/e4eead665c
2020-09-25 17:28:42 +09:00
BurdetteLamar 36b2177ea8 [flori/json] Enhance RDoc for JSON.parse
https://github.com/flori/json/commit/33e64ef255
2020-09-25 17:28:42 +09:00
BurdetteLamar 71b1bbad02 [flori/json] Move options from #generate and #parse to common area
https://github.com/flori/json/commit/20d7be605a
2020-09-25 17:28:42 +09:00
Keith Bennett c3614877d2 [flori/json] Add `load_file` and `load_file!` methods, with tests. Fixes issue #386.
https://github.com/flori/json/commit/0be363c99b
2020-09-25 17:28:42 +09:00
Jean Boussier e1659af372 Add an option to escape forward slash character
Squashed commit of the following:

commit 26d181059989279a79c433cedcd893b4f52e42ee
Author: Francois Chagnon <francois.chagnon@jadedpixel.com>
Date:   Tue Sep 15 21:17:34 2015 +0000

    add config options for escape_slash

commit fa282334051b16df91ca097dd7304b46f3bc7719
Author: Francois Chagnon <francois.chagnon@jadedpixel.com>
Date:   Mon Feb 9 21:09:33 2015 +0000

    add forward slash to escape character
2020-09-25 17:28:42 +09:00
卜部昌平 490010084e sed -i '/rmodule.h/d' 2020-08-27 16:42:06 +09:00
卜部昌平 756403d775 sed -i '/r_cast.h/d' 2020-08-27 15:03:36 +09:00
卜部昌平 0da2a3f1fc sed -i '\,2/extern.h,d' 2020-08-27 14:07:49 +09:00
Hiroshi SHIBATA 0aac138e0b
Merge json-2.3.1 from flori/json 2020-07-01 18:50:39 +09:00
Marc-Andre Lafortune 26041da2fb
[flori/json] Typo fix
https://github.com/flori/json/commit/26c1769969
2020-07-01 18:47:51 +09:00
BurdetteLamar d69b55ac05
[flori/json] Added :call-seq: to RDOc for some methods
https://github.com/flori/json/commit/ee5b6a74e9
2020-07-01 18:47:51 +09:00
Watson cb3e62511c
[flori/json] Use frozen string for hash key
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 << {
    "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 < iter
      JSON.parse(json)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/18292c0c1d
2020-07-01 18:47:51 +09:00
BurdetteLamar 7d8ce96de6
[flori/json] RDoc enhancements
https://github.com/flori/json/commit/ada48f0236
2020-07-01 18:47:51 +09:00
BurdetteLamar be6447381c
[flori/json] RDoc enhancements
https://github.com/flori/json/commit/470d909c0d
2020-07-01 18:47:51 +09:00
BurdetteLamar 99980b3034
[flori/json] RDoc enhancements
https://github.com/flori/json/commit/7bee2c7c13
2020-07-01 18:47:51 +09:00
BurdetteLamar 4689fd5f99
[flori/json] Rdoc enhancements
https://github.com/flori/json/commit/e7e3732130
2020-07-01 18:47:50 +09:00
Nobuyoshi Nakada 9a78e24f7d
Removed nonsense `rubygems_version` in input gemspec files
As it is ignored and set at building packages automatically, it is
just nonsense to set in gemspec file for input.
2020-06-25 15:44:56 +09:00
noraj 4eff8a662a
[flori/json] add metadata
https://github.com/flori/json/commit/9f430a7bba
2020-06-25 15:32:41 +09:00
Hiroshi SHIBATA 1b076ca30d
[flori/json] Gem::Specification#date is set automatically by RubyGems.org.
https://github.com/flori/json/commit/1920653013
2020-06-25 15:32:41 +09:00
Hiroshi SHIBATA 4dbb10f29f
[flori/json] keyword argument is provided after Ruby 2.0+
https://github.com/flori/json/commit/78ec5e2bd3
2020-06-25 15:32:40 +09:00
Yusuke Endoh 8bd27c547c ext/json/parser/prereq.mk: remove type-limit warning if char is unsigned
Ragel generates a code `0 <= (*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 <= (*p) && (*p) <= 31 )
  ^
parser.c:1596:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  if ( 0 <= (*p) && (*p) <= 31 )
  ^
```

This change removes the warning by substituting the condition with
`0 <= (signed char)(*p)`.
2020-05-14 00:44:35 +09:00
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
zverok 7f1e3a7b7c [flori/json] Add :nodoc: for GeneratorMethods
https://github.com/flori/json/commit/2f3f44c180
2020-01-06 15:13:50 +09:00
zverok 41ef6df8c9 [flori/json] Fix examples syntax
https://github.com/flori/json/commit/3845491d92
2020-01-06 15:13:35 +09:00
zverok 2e5ef30cb9 [flori/json] Enchance generic JSON and #generate docs
https://github.com/flori/json/commit/4ede0a7d19
2020-01-06 15:13:15 +09:00
Jeremy Evans 1658e6b5db
[flori/json] Remove invalid JSON.generate description from JSON module rdoc
This text used to be true in older versions of json, but has not
been true for a number of years (since json version 2 I think).

https://github.com/flori/json/commit/373b633f38
2020-01-06 15:09:55 +09:00
Hiroshi SHIBATA 53e8589c69
Import json-2.3.0 from flori/json 2019-12-12 09:14:09 +09:00
Nobuyoshi Nakada 65f7e3156f
Removed duplicate file
"./tests/test_helper.rb" and "tests/test_helper.rb" in `s.files`
are same.
2019-11-11 15:57:21 +09:00
Aaron Patterson 1d564acedc
Remove unused constant.
This constant isn't used, so lets remove it.
2019-10-17 13:35:26 -07:00
Aaron Patterson 9026e12f93
Look up constant instead of caching in a global
The global can go bad if the compactor runs, so we need to look up the
constant instead of caching it in a global.
2019-10-17 13:30:09 -07:00
Sho Hashimoto 308bbb4e10
[flori/json] Add ascii_only option to JSON::Ext::Generator::State.new.
https://github.com/flori/json/commit/0e99a9aac5
2019-10-14 19:54:49 +09:00
Watson 98a9445db9
[flori/json] Add shortcut converting to String
In where to convert Hash key to String for json, this patch will add shortcut for String/Symbol in Hash key.

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    65.000  i/100ms
Calculating -------------------------------------
                json    659.576  (± 1.5%) i/s -      3.315k in   5.027127s
```

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    78.000  i/100ms
Calculating -------------------------------------
                json    789.781  (± 2.7%) i/s -      3.978k in   5.041043s
```

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

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/38c0f6dbe4
2019-10-14 19:54:49 +09:00
Watson a2f9c38a71
[flori/json] Convert Hash object using rb_hash_foreach()
To convert Hash convert, this part was using following pseudo code

```
obj.keys.each do |key|
  value = obj[key]
  ...
end
```

and `rb_funcall()` was called for `obj.keys`.
It might be slightly heavy to call the Ruby method.
This patch will iterate to convert Hash object about key/value using `rb_hash_foreach()` Ruby API instead of `rb_funcall()`.

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    55.000  i/100ms
Calculating -------------------------------------
                json    558.501  (± 1.1%) i/s -      2.805k in   5.022986s
```

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    65.000  i/100ms
Calculating -------------------------------------
                json    659.576  (± 1.5%) i/s -      3.315k in   5.027127s
```

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

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/a73323dc5e
2019-10-14 19:54:49 +09:00
Nobuyoshi Nakada 2003755a2c
[flori/json] Fixed unexpected illegal/malformed utf-8 error
flori/json@c34d01ff6a does not
consider US-ASCII compatible but non-UTF-8 encodings, and causes
an error in RDoc tests.

https://github.com/flori/json/commit/4f471bf590
2019-10-14 19:54:48 +09:00
Watson d7fa7e2c86
[flori/json] Convert string encoding to UTF-8 only when needed
## Before
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json   129.000  i/100ms
Calculating -------------------------------------
                json      1.300k (± 2.3%) i/s -      6.579k in   5.064656s
```

## After
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json   189.000  i/100ms
Calculating -------------------------------------
                json      1.964k (± 3.3%) i/s -      9.828k in   5.011237s
```

## Code
```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/c34d01ff6a
2019-10-14 19:54:48 +09:00
Watson 40724d7d10
[flori/json] Convert String encoding using `rb_str_encode()`
`rb_funcall` might be slightly heavy to call the Ruby method.
This patch will convert String encoding using `rb_str_encode()` instead of `rb_funcall()`.

## Before
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    78.000  i/100ms
Calculating -------------------------------------
                json    789.781  (± 2.7%) i/s -      3.978k in   5.041043s
```

## After
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json   129.000  i/100ms
Calculating -------------------------------------
                json      1.300k (± 2.3%) i/s -      6.579k in   5.064656s
```

## Code
```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/9ae6d2969c
2019-10-14 19:54:48 +09:00