selma 0.4.0-arm64-darwin → 0.4.2-arm64-darwin

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: d6bb6c8578e105b0560e49f1b502956983ab8eb02db533f4caf43857414b0ccc
4
- data.tar.gz: 8a5b9c7f8e46d19ab1171d6f750448307f3267cb51755f298ac087f01f4789e3
3
+ metadata.gz: d7f11de2e8dc7666f595ff6b6e86f4a20375aadf46fcc90a53fa29dbeed171fb
4
+ data.tar.gz: f914455f9ad71ae85a52426e80c21f0956c5292138321b0eb5ec4db3c3f5ca1b
5
5
  SHA512:
6
- metadata.gz: e14dfdb6246435b07d304280d62599d11e92c5a9ed98b31c6c058f691170cf43499832d5cd4fa8174e4e637b0aa924e7c96cb8c191cdf3d9614c5ee3694d14a6
7
- data.tar.gz: 668120ad7fc59e27e487d7efc84086ba6ee1a6f86eebf2b35065aa36bb4bb719a4bf5bd334270335904b5ea35fb2d07ba608ecc6dc190b6eef35e2c0920bd31a
6
+ metadata.gz: 4192c16a6a347066de08a6215ae4f694d080b586f394667ef9066f227c17e37cb0c6f58852b96cd6b5ade9e787544dff76045e6499d28a2b4082f6588678c839
7
+ data.tar.gz: d0cbb72e4abccbc5bfcff0ed2335eb72dfa8532180c8da811774a0535b1d1af6ecf4ef970a4597a620d3abe9308022377bb33148e478fc8cfc4ad4a1a8f93eda
data/README.md CHANGED
@@ -182,13 +182,20 @@ The `element` argument in `handle_element` has the following methods:
182
182
 
183
183
  ## Security
184
184
 
185
- Theoretically, a malicious user can provide a very large document for processing, which can exhaust the memory of the host machine. To set a limit on how much string content is processed at once, you can provide two options into the `memory` namespace:
185
+ Theoretically, a malicious user can provide a very large document for processing, which can exhaust the memory of the host machine. To set a limit on how much string content is processed at once, you can provide `memory` options:
186
186
 
187
187
  ```ruby
188
- memory: {
189
- max_allowed_memory_usage: 1000,
190
- preallocated_parsing_buffer_size: 100,
191
- },
188
+ Selma::Rewriter.new(options: { memory: { max_allowed_memory_usage: 1_000_000 } }) # ~1MB
189
+ ```
190
+
191
+ The structure of the `memory` options looks like this:
192
+ ```ruby
193
+ {
194
+ memory: {
195
+ max_allowed_memory_usage: 1000,
196
+ preallocated_parsing_buffer_size: 100,
197
+ }
198
+ }
192
199
  ```
193
200
 
194
201
  Note that `preallocated_parsing_buffer_size` must always be less than `max_allowed_memory_usage`. See [the`lol_html` project documentation](https://docs.rs/lol_html/1.2.1/lol_html/struct.MemorySettings.html) to learn more about the default values.
@@ -208,29 +215,29 @@ input size = 25309 bytes, 0.03 MB
208
215
 
209
216
  ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
210
217
  Warming up --------------------------------------
211
- sanitize-sm 16.000 i/100ms
212
- selma-sm 214.000 i/100ms
218
+ sanitize-sm 15.000 i/100ms
219
+ selma-sm 127.000 i/100ms
213
220
  Calculating -------------------------------------
214
- sanitize-sm 171.670 (± 1.2%) i/s - 5.152k in 30.017081s
215
- selma-sm 2.146k3.0%) i/s - 64.414k in 30.058470s
221
+ sanitize-sm 157.643 (± 1.9%) i/s - 4.740k in 30.077172s
222
+ selma-sm 1.278k1.5%) i/s - 38.354k in 30.019722s
216
223
 
217
224
  Comparison:
218
- selma-sm: 2145.8 i/s
219
- sanitize-sm: 171.7 i/s - 12.50x slower
225
+ selma-sm: 1277.9 i/s
226
+ sanitize-sm: 157.6 i/s - 8.11x slower
220
227
 
221
228
  input size = 86686 bytes, 0.09 MB
222
229
 
223
230
  ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
224
231
  Warming up --------------------------------------
225
232
  sanitize-md 4.000 i/100ms
226
- selma-md 56.000 i/100ms
233
+ selma-md 33.000 i/100ms
227
234
  Calculating -------------------------------------
228
- sanitize-md 44.3972.3%) i/s - 1.332k in 30.022430s
229
- selma-md 558.448 (± 1.4%) i/s - 16.800k in 30.089196s
235
+ sanitize-md 40.0345.0%) i/s - 1.200k in 30.043322s
236
+ selma-md 332.9592.1%) i/s - 9.999k in 30.045733s
230
237
 
231
238
  Comparison:
232
- selma-md: 558.4 i/s
233
- sanitize-md: 44.4 i/s - 12.58x slower
239
+ selma-md: 333.0 i/s
240
+ sanitize-md: 40.0 i/s - 8.32x slower
234
241
 
235
242
  input size = 7172510 bytes, 7.17 MB
236
243
 
@@ -239,12 +246,12 @@ Warming up --------------------------------------
239
246
  sanitize-lg 1.000 i/100ms
240
247
  selma-lg 1.000 i/100ms
241
248
  Calculating -------------------------------------
242
- sanitize-lg 0.163 (± 0.0%) i/s - 6.000 in 37.375628s
243
- selma-lg 6.750 (± 0.0%) i/s - 203.000 in 30.080976s
249
+ sanitize-lg 0.141 (± 0.0%) i/s - 5.000 in 35.426127s
250
+ selma-lg 3.963 (± 0.0%) i/s - 119.000 in 30.037386s
244
251
 
245
252
  Comparison:
246
- selma-lg: 6.7 i/s
247
- sanitize-lg: 0.2 i/s - 41.32x slower
253
+ selma-lg: 4.0 i/s
254
+ sanitize-lg: 0.1 i/s - 28.03x slower
248
255
  </pre>
249
256
  </details>
250
257
  <!-- prettier-ignore-end -->
@@ -255,39 +262,40 @@ Comparing Selma against popular Ruby HTML parsing gems:
255
262
 
256
263
  <!-- prettier-ignore-start -->
257
264
  <details>
258
- <pre>input size = 25309 bytes, 0.03 MB
265
+ <pre>
266
+ input size = 25309 bytes, 0.03 MB
259
267
 
260
268
  ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
261
269
  Warming up --------------------------------------
262
- nokogiri-sm 107.000 i/100ms
263
- nokolexbor-sm 340.000 i/100ms
264
- selma-sm 380.000 i/100ms
270
+ nokogiri-sm 79.000 i/100ms
271
+ nokolexbor-sm 295.000 i/100ms
272
+ selma-sm 237.000 i/100ms
265
273
  Calculating -------------------------------------
266
- nokogiri-sm 1.073k (± 2.1%) i/s - 32.207k in 30.025474s
267
- nokolexbor-sm 3.300k13.2%) i/s - 27.540k in 36.788212s
268
- selma-sm 3.779k3.4%) i/s - 113.240k in 30.013908s
274
+ nokogiri-sm 800.531 (± 2.2%) i/s - 24.016k in 30.016056s
275
+ nokolexbor-sm 3.033k 3.6%) i/s - 91.155k in 30.094884s
276
+ selma-sm 2.386k1.6%) i/s - 71.574k in 30.001701s
269
277
 
270
278
  Comparison:
271
- selma-sm: 3779.4 i/s
272
- nokolexbor-sm: 3300.1 i/s - same-ish: difference falls within error
273
- nokogiri-sm: 1073.1 i/s - 3.52x slower
279
+ nokolexbor-sm: 3033.1 i/s
280
+ selma-sm: 2386.3 i/s - 1.27x slower
281
+ nokogiri-sm: 800.5 i/s - 3.79x slower
274
282
 
275
283
  input size = 86686 bytes, 0.09 MB
276
284
 
277
285
  ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
278
286
  Warming up --------------------------------------
279
- nokogiri-md 11.000 i/100ms
280
- nokolexbor-md 48.000 i/100ms
281
- selma-md 53.000 i/100ms
287
+ nokogiri-md 8.000 i/100ms
288
+ nokolexbor-md 43.000 i/100ms
289
+ selma-md 38.000 i/100ms
282
290
  Calculating -------------------------------------
283
- nokogiri-md 103.9985.8%) i/s - 3.113k in 30.029932s
284
- nokolexbor-md 428.928 7.9%) i/s - 12.816k in 30.066662s
285
- selma-md 492.1906.9%) i/s - 14.734k in 30.082943s
291
+ nokogiri-md 85.0138.2%) i/s - 2.024k in 52.257472s
292
+ nokolexbor-md 416.07411.1%) i/s - 12.341k in 30.111613s
293
+ selma-md 361.4714.7%) i/s - 10.830k in 30.033997s
286
294
 
287
295
  Comparison:
288
- selma-md: 492.2 i/s
289
- nokolexbor-md: 428.9 i/s - same-ish: difference falls within error
290
- nokogiri-md: 104.0 i/s - 4.73x slower
296
+ nokolexbor-md: 416.1 i/s
297
+ selma-md: 361.5 i/s - same-ish: difference falls within error
298
+ nokogiri-md: 85.0 i/s - 4.89x slower
291
299
 
292
300
  input size = 7172510 bytes, 7.17 MB
293
301
 
@@ -297,14 +305,14 @@ Warming up --------------------------------------
297
305
  nokolexbor-lg 1.000 i/100ms
298
306
  selma-lg 1.000 i/100ms
299
307
  Calculating -------------------------------------
300
- nokogiri-lg 0.874 (± 0.0%) i/s - 27.000 in 30.921090s
301
- nokolexbor-lg 2.227 (± 0.0%) i/s - 67.000 in 30.137903s
302
- selma-lg 8.354 (± 0.0%) i/s - 251.000 in 30.075227s
308
+ nokogiri-lg 0.805 (± 0.0%) i/s - 25.000 in 31.148730s
309
+ nokolexbor-lg 2.194 (± 0.0%) i/s - 66.000 in 30.278108s
310
+ selma-lg 5.541 (± 0.0%) i/s - 166.000 in 30.037197s
303
311
 
304
312
  Comparison:
305
- selma-lg: 8.4 i/s
306
- nokolexbor-lg: 2.2 i/s - 3.75x slower
307
- nokogiri-lg: 0.9 i/s - 9.56x slower
313
+ selma-lg: 5.5 i/s
314
+ nokolexbor-lg: 2.2 i/s - 2.53x slower
315
+ nokogiri-lg: 0.8 i/s - 6.88x slower
308
316
  </pre>
309
317
  </details>
310
318
  <!-- prettier-ignore-end -->
Binary file
Binary file
Binary file
data/lib/selma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Selma
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-15 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake