Skip to content

Commit d859f16

Browse files
Update README to include details about JSON caching
1 parent b75c683 commit d859f16

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Bootsnap [![Actions Status](https://github.com/Shopify/bootsnap/workflows/ci/badge.svg)](https://github.com/Shopify/bootsnap/actions)
22

3-
Bootsnap is a library that plugs into Ruby, with optional support for `YAML`,
3+
Bootsnap is a library that plugs into Ruby, with optional support for `YAML` and `JSON`,
44
to optimize and cache expensive computations. See [How Does This Work](#how-does-this-work).
55

66
#### Performance
@@ -57,6 +57,7 @@ Bootsnap.setup(
5757
load_path_cache: true, # Optimize the LOAD_PATH with a cache
5858
compile_cache_iseq: true, # Compile Ruby code into ISeq cache, breaks coverage reporting.
5959
compile_cache_yaml: true, # Compile YAML into a cache
60+
compile_cache_json: true, # Compile JSON into a cache
6061
readonly: true, # Use the caches but don't update them on miss or stale entries.
6162
)
6263
```
@@ -119,6 +120,7 @@ into two broad categories:
119120
compilation.
120121
* `YAML.load_file` is modified to cache the result of loading a YAML object in MessagePack format
121122
(or Marshal, if the message uses types unsupported by MessagePack).
123+
* `JSON.load_file` is modified to cache the result of loading a JSON object in MessagePack format
122124

123125
### Path Pre-Scanning
124126

@@ -189,9 +191,9 @@ translated ruby source to an internal bytecode format, which is then executed by
189191
allows caching that bytecode. This allows us to bypass the relatively-expensive compilation step on
190192
subsequent loads of the same file.
191193

192-
We also noticed that we spend a lot of time loading YAML documents during our application boot, and
193-
that MessagePack and Marshal are *much* faster at deserialization than YAML, even with a fast
194-
implementation. We use the same strategy of compilation caching for YAML documents, with the
194+
We also noticed that we spend a lot of time loading YAML and JSON documents during our application boot, and
195+
that MessagePack and Marshal are *much* faster at deserialization than YAML and JSON, even with a fast
196+
implementation. We use the same strategy of compilation caching for YAML and JSON documents, with the
195197
equivalent of Ruby's "bytecode" format being a MessagePack document (or, in the case of YAML
196198
documents with types unsupported by MessagePack, a Marshal stream).
197199

0 commit comments

Comments
 (0)