Skip to content

Commit 2ebf53f

Browse files
authored
Merge pull request #18 from DeflateAwning/proof-readme
Proofread README
2 parents f689ad7 + 6c76c62 commit 2ebf53f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
(Maybe) Ruby's fastest JSON library! Built using the [RapidJSON C++ library](https://rapidjson.org/)
44

5-
No monkey patches, ActiveSupport integration, `json` gem emulation.
5+
ActiveSupport integration, `json` gem emulation, and no monkey patches.
66

77
## Installation
88

@@ -44,24 +44,24 @@ RapidJSON.pretty_encode(json_string)
4444
# }
4545
```
4646

47-
By default the encoder is "strict" and will raise an exception
47+
By default the encoder is "strict" and will raise an exception.
4848

4949
## ActiveSupport
5050

5151
RapidJSON provides a drop-in replacement ActiveSupport encoder, with very good compatibility.
5252
Add the following to an initializer to opt-in.
5353

54-
```
54+
```ruby
5555
# config/initializers/rapidjson.rb
5656

5757
ActiveSupport::JSON::Encoding.json_encoder = RapidJSON::ActiveSupportEncoder
5858
```
5959

60-
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)
6161

6262
## JSON gem compatibility
6363

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.
6565

6666
However it does provide a module that behave like the stdlib JSON gem and that can be used to monkey patch existing code.
6767

@@ -86,7 +86,7 @@ By default RapidJSON will only encode "JSON-ready" types: `Hash`, `Array`, `Inte
8686

8787
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:.
8888

89-
```
89+
```ruby
9090
RapidJSON::Coder.new do |object, is_key|
9191
object.to_s # Convert any unknown object to string
9292
end
@@ -105,11 +105,11 @@ Unless there's good reason, it's probably best sticking with the standard `json`
105105
However this library has a few performance advantages:
106106

107107
* 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.
109109
* Object allocation
110110
* 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)
111111
* 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
113113
* Whenever possible we build Ruby objects from C types (int, char \*, double) rather than constructing intermediate Ruby string objects.
114114

115115
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:/
158158

159159
## Code of Conduct
160160

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

Comments
 (0)