You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This makes `model.to_json`~15x faster, and `nested_hash.to_json`~27x faster (compred using Rails 7.0)
60
+
This makes `model.to_json`~15x faster, and `nested_hash.to_json`~27x faster (compared using Rails 7.0)
61
61
62
62
## JSON gem compatibility
63
63
64
-
Contrary to some other JSON libraries, `RapidJSON` doesn't provice a monkey patch to entirely replace the stdlib JSON gem.
64
+
Contrary to some other JSON libraries, `RapidJSON` doesn't provide a monkey patch to entirely replace the stdlib JSON gem.
65
65
66
66
However it does provide a module that behave like the stdlib JSON gem and that can be used to monkey patch existing code.
67
67
@@ -86,7 +86,7 @@ By default RapidJSON will only encode "JSON-ready" types: `Hash`, `Array`, `Inte
86
86
87
87
RapidJSON::Coder can be initialized with a block which allows the behaviour to be customized. This is how the ActiveSupport encoder and JSON compatibility above are implemented! Just using Ruby :heart:.
88
88
89
-
```
89
+
```ruby
90
90
RapidJSON::Coder.newdo |object, is_key|
91
91
object.to_s # Convert any unknown object to string
92
92
end
@@ -105,11 +105,11 @@ Unless there's good reason, it's probably best sticking with the standard `json`
105
105
However this library has a few performance advantages:
106
106
107
107
* JSON parsing
108
-
* Performance is achieved mostly through using RapidJSON one of the fastest open source JSON parsing libraries. It supports SIMD (SSE2, SSE4.2, NEON), avoids allocated memory, and has been honed to be if not the fastest library (that honour likely going to simdjson) the library to beat for JSON performance.
108
+
* Performance is achieved mostly through using RapidJSON one of the fastest open source JSON parsing libraries. It supports SIMD (SSE2, SSE4.2, NEON), avoids allocated memory, and has been honed to be if not the fastest library (that honour likely going to simdjson), the library to beat for JSON performance.
109
109
* Object allocation
110
110
* Wherever possible we avoid allocating objects. When generating JSON, RapidJSON will write the emitted JSON directly into the buffer of a Ruby string. (This is an optimization most Ruby JSON libraries will have)
111
111
* When parsing JSON we parse directly form the source string with a single copy
112
-
* When building a Hash for a JSON object, we use an fstrings (dedup'd and frozen strings) as the key
112
+
* When building a Hash for a JSON object, we use `fstrings` (dedup'd and frozen strings) as the key
113
113
* Whenever possible we build Ruby objects from C types (int, char \*, double) rather than constructing intermediate Ruby string objects.
114
114
115
115
Many of these optimization can be found in all popular Ruby JSON libraries
@@ -158,4 +158,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
158
158
159
159
## Code of Conduct
160
160
161
-
Everyone interacting in the Rapidjson project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jhawthorn/rapidjson/blob/main/CODE_OF_CONDUCT.md).
161
+
Everyone interacting in the RapidJSON project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/jhawthorn/rapidjson/blob/main/CODE_OF_CONDUCT.md).
0 commit comments