bootsnap 1.12.0 → 1.18.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 761e97c3b4772e9c0af1bd8391d70dddebd94addf88e9295e72a790a85deb5e0
4
- data.tar.gz: 17f80fcf67adc6a4e7f9fb475d3e7d5c008c89b491e23804da1f2603e859888c
3
+ metadata.gz: 2b2271b2fa08edc313e43ec1359be530fcb6b206a7b4b63f37065290289cbc9a
4
+ data.tar.gz: c5838e7d01c33320e765a2bf668c68c09fc6b0938fb8789653b526cb3c22a244
5
5
  SHA512:
6
- metadata.gz: dca99dc5e57a644e627e8705958c8c4916a9c444c2a64788fd4214aa174d6c3eed7fc15ef7bdb6e06922fb8d1eef3beeff08e316aadbc3015a36e82b1a232309
7
- data.tar.gz: 1c9ffc9c5c04694f4838693edda976f58925649f7b14411d61bec64eca10bb04548c5bb4e2be6ff897c8d5a0e929aa2cd885d017ccd1770530971fedba831ec3
6
+ metadata.gz: 77168e700a54163bf4574fbf9f82fea681a01f7d0c5c3a55340d3dabc98959fce1176bebef4c4d25d18efa257ad5314f13ca978a77f5cb4288296c63a1b36871
7
+ data.tar.gz: cc770950cc3032a5033873457a23b19823c35d9d24285f3b13fb95848e51d8f34defca5396c7b545b5530381271979c93026401e4ac32d28ec0f89ceadd57823
data/CHANGELOG.md CHANGED
@@ -1,12 +1,84 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.18.4
4
+
5
+ * Allow using bootsnap without bundler. See #488.
6
+ * Fix startup failure if the cache directory points to a broken symlink.
7
+
8
+ # 1.18.3
9
+
10
+ * Fix the cache corruption issue in the revalidation feature. See #474.
11
+ The cache revalidation feature remains opt-in for now, until it is more battle tested.
12
+
13
+ # 1.18.2
14
+
15
+ * Disable stale cache entries revalidation by default as it seems to cause cache corruption issues. See #471 and #474.
16
+ Will be re-enabled in a future version once the root cause is identified.
17
+ * Fix a potential compilation issue on some systems. See #470.
18
+
19
+ # 1.18.1
20
+
21
+ * Handle `EPERM` errors when opening files with `O_NOATIME`.
22
+
23
+ # 1.18.0
24
+
25
+ * `Bootsnap.instrumentation` now receive `:hit` events.
26
+ * Add `Bootsnap.log_stats!` to print hit rate statistics on process exit. Can also be enabled with `BOOTSNAP_STATS=1`.
27
+ * Revalidate stale cache entries by digesting the source content.
28
+ This should significantly improve performance in environments where `mtime` isn't preserved (e.g. CI systems doing a git clone, etc).
29
+ See #468.
30
+ * Open source files and cache entries with `O_NOATIME` when available to reduce disk accesses. See #469.
31
+ * `bootsnap precompile --gemfile` now look for `.rb` files in the whole gem and not just the `lib/` directory. See #466.
32
+
33
+ # 1.17.1
34
+
35
+ * Fix a compatibility issue with the `prism` library that ships with Ruby 3.3. See #463.
36
+ * Improved the `Kernel#require` decorator to not cause a method redefinition warning. See #461.
37
+
38
+ # 1.17.0
39
+
40
+ * Ensure `$LOAD_PATH.dup` is Ractor shareable to fix a conflict with `did_you_mean`.
41
+ * Allow to ignore directories using absolute paths.
42
+ * Support YAML and JSON CompileCache on TruffleRuby.
43
+ * Support LoadPathCache on TruffleRuby.
44
+
45
+ # 1.16.0
46
+
47
+ * Use `RbConfig::CONFIG["rubylibdir"]` instead of `RbConfig::CONFIG["libdir"]` to check for stdlib files. See #431.
48
+ * Fix the cached version of `YAML.load_file` being slightly more permissive than the default `Psych` one. See #434.
49
+ `Date` and `Time` values are now properly rejected, as well as aliases.
50
+ If this causes a regression in your application, it is recommended to load *trusted* YAML files with `YAML.unsafe_load_file`.
51
+
52
+ # 1.15.0
53
+
54
+ * Add a readonly mode, for environments in which the updated cache wouldn't be persisted. See #428 and #423.
55
+
56
+ # 1.14.0
57
+
58
+ * Require Ruby 2.6.
59
+ * Add a way to skip directories during load path scanning.
60
+ If you have large non-ruby directories in the middle of your load path, it can severely slow down scanning.
61
+ Typically this is a problem with `node_modules`. See #277.
62
+ * Fix `Bootsnap.unload_cache!`, it simply wouldn't work at all because of a merge mistake. See #421.
63
+
64
+ # 1.13.0
65
+
66
+ * Stop decorating `Kernel.load`. This used to be very useful in development because the Rails "classic" autoloader
67
+ was using `Kernel.load` in dev and `Kernel.require` in production. But Zeitwerk is now the default, and it doesn't
68
+ use `Kernel.load` at all.
69
+
70
+ People still using the classic autoloader might want to stick to `bootsnap 1.12`.
71
+
72
+ * Add `Bootsnap.unload_cache!`. Applications can call it at the end of their boot sequence when they know
73
+ no more code will be loaded to reclaim a bit of memory.
74
+
3
75
  # 1.12.0
4
76
 
5
77
  * `bootsnap precompile` CLI will now also precompile `Rakefile` and `.rake` files.
6
78
 
7
79
  * Stop decorating `Module#autoload` as it was only useful for supporting Ruby 2.2 and older.
8
80
 
9
- * Remove `uname` and other patform specific version from the cache keys. `RUBY_PLATFORM + RUBY_REVISION` should be
81
+ * Remove `uname` and other platform specific version from the cache keys. `RUBY_PLATFORM + RUBY_REVISION` should be
10
82
  enough to ensure bytecode compatibility. This should improve caching for alpine based setups. See #409.
11
83
 
12
84
  # 1.11.1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bootsnap [![Actions Status](https://github.com/Shopify/bootsnap/workflows/ci/badge.svg)](https://github.com/Shopify/bootsnap/actions)
2
2
 
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`,
4
4
  to optimize and cache expensive computations. See [How Does This Work](#how-does-this-work).
5
5
 
6
6
  #### Performance
@@ -52,10 +52,13 @@ require 'bootsnap'
52
52
  env = ENV['RAILS_ENV'] || "development"
53
53
  Bootsnap.setup(
54
54
  cache_dir: 'tmp/cache', # Path to your cache
55
+ ignore_directories: ['node_modules'], # Directory names to skip.
55
56
  development_mode: env == 'development', # Current working environment, e.g. RACK_ENV, RAILS_ENV, etc
56
57
  load_path_cache: true, # Optimize the LOAD_PATH with a cache
57
58
  compile_cache_iseq: true, # Compile Ruby code into ISeq cache, breaks coverage reporting.
58
- compile_cache_yaml: true # Compile YAML into a cache
59
+ compile_cache_yaml: true, # Compile YAML into a cache
60
+ compile_cache_json: true, # Compile JSON into a cache
61
+ readonly: true, # Use the caches but don't update them on miss or stale entries.
59
62
  )
60
63
  ```
61
64
 
@@ -66,7 +69,7 @@ will help optimize boot time further if you have an extremely large `$LOAD_PATH`
66
69
  Note: Bootsnap and [Spring](https://github.com/rails/spring) are orthogonal tools. While Bootsnap
67
70
  speeds up the loading of individual source files, Spring keeps a copy of a pre-booted Rails process
68
71
  on hand to completely skip parts of the boot process the next time it's needed. The two tools work
69
- well together, and are both included in a newly-generated Rails applications by default.
72
+ well together.
70
73
 
71
74
  ### Environment variables
72
75
 
@@ -76,7 +79,12 @@ well together, and are both included in a newly-generated Rails applications by
76
79
  - `DISABLE_BOOTSNAP` allows to entirely disable bootsnap.
77
80
  - `DISABLE_BOOTSNAP_LOAD_PATH_CACHE` allows to disable load path caching.
78
81
  - `DISABLE_BOOTSNAP_COMPILE_CACHE` allows to disable ISeq and YAML caches.
82
+ - `BOOTSNAP_READONLY` configure bootsnap to not update the cache on miss or stale entries.
79
83
  - `BOOTSNAP_LOG` configure bootsnap to log all caches misses to STDERR.
84
+ - `BOOTSNAP_STATS` log hit rate statistics on exit. Can't be used if `BOOTSNAP_LOG` is enabled.
85
+ - `BOOTSNAP_IGNORE_DIRECTORIES` a comma separated list of directories that shouldn't be scanned.
86
+ Useful when you have large directories of non-ruby files inside `$LOAD_PATH`.
87
+ It defaults to ignore any directory named `node_modules`.
80
88
 
81
89
  ### Environments
82
90
 
@@ -92,8 +100,8 @@ Bootsnap cache misses can be monitored though a callback:
92
100
  Bootsnap.instrumentation = ->(event, path) { puts "#{event} #{path}" }
93
101
  ```
94
102
 
95
- `event` is either `:miss` or `:stale`. You can also call `Bootsnap.log!` as a shortcut to
96
- log all events to STDERR.
103
+ `event` is either `:hit`, `:miss`, `:stale` or `:revalidated`.
104
+ You can also call `Bootsnap.log!` as a shortcut to log all events to STDERR.
97
105
 
98
106
  To turn instrumentation back off you can set it to nil:
99
107
 
@@ -113,6 +121,7 @@ into two broad categories:
113
121
  compilation.
114
122
  * `YAML.load_file` is modified to cache the result of loading a YAML object in MessagePack format
115
123
  (or Marshal, if the message uses types unsupported by MessagePack).
124
+ * `JSON.load_file` is modified to cache the result of loading a JSON object in MessagePack format
116
125
 
117
126
  ### Path Pre-Scanning
118
127
 
@@ -183,9 +192,9 @@ translated ruby source to an internal bytecode format, which is then executed by
183
192
  allows caching that bytecode. This allows us to bypass the relatively-expensive compilation step on
184
193
  subsequent loads of the same file.
185
194
 
186
- We also noticed that we spend a lot of time loading YAML documents during our application boot, and
187
- that MessagePack and Marshal are *much* faster at deserialization than YAML, even with a fast
188
- implementation. We use the same strategy of compilation caching for YAML documents, with the
195
+ We also noticed that we spend a lot of time loading YAML and JSON documents during our application boot, and
196
+ that MessagePack and Marshal are *much* faster at deserialization than YAML and JSON, even with a fast
197
+ implementation. We use the same strategy of compilation caching for YAML and JSON documents, with the
189
198
  equivalent of Ruby's "bytecode" format being a MessagePack document (or, in the case of YAML
190
199
  documents with types unsupported by MessagePack, a Marshal stream).
191
200