skyfall 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db537537fcd4e38f184c6cdea3f51ba1b8554848d4c3cd1de20f63ca2d956fc2
4
- data.tar.gz: 34c51f6c8c0152589562bf0a3b3c5246cd8a1e95664f1128c86bd17c6a313d59
3
+ metadata.gz: 1fa2648926fdc913472ec8fca4d6bdf3bbac188dbb0d9c82816538ca0c446d23
4
+ data.tar.gz: f35348c4834fb9dc26544105074bdc4f9ba07c36d595e5c248651d47e5dc188e
5
5
  SHA512:
6
- metadata.gz: 11477293a1bc0377ef5d9eaa68cc2d374f76ac4d942006572e8b9e1668cb8f54a582abdeda81b65c1d72f6452ba2cad1153c403027ba5d7efbfa093624713105
7
- data.tar.gz: 8d86b1f71a4fd5fa7f01077fefe8d8e292dc6b5007b79ee4d1ed1343f887c4104c0480b297e7ce4be61db0cce65211a568b642411fa5c3e7f62c4c91a4fe0f7b
6
+ metadata.gz: df775bdf85f5fe73f5fc5f27868b4ad8755219e98dfae72a32e7a9bb66295b463f65a2ebd9a8c956d74f200f667a9f02c00310e665a506f69a950db03eec4ad6
7
+ data.tar.gz: 6dfe5acf800a9765d0ad6f3ce78e7a6aae445a2dde4028ef3af39ff81a5fc3947080ecfb0ceb0dcf439a2db3e6d65e17376b187455fa1eaf56889c87d0137be1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.4.1] - 2024-10-04
2
+
3
+ - performance fix - don't decode CAR sections which aren't needed, which is most of them; this cuts the amount of memory that GC has to free up by about one third, and should speed up processing by around ~10%
4
+
1
5
  ## [0.4.0] - 2024-09-23
2
6
 
3
7
  - (re)added a "hearbeat" feature (removed earlier in 0.2.0) to fix the occasional issue when the websocket stops receiving data, but doesn't disconnect (not enabled by default, turn it on by setting `check_heartbeat` to true)
@@ -11,11 +11,15 @@ require 'stringio'
11
11
 
12
12
  module Skyfall
13
13
  class CarSection
14
- attr_reader :cid, :body
14
+ attr_reader :cid
15
15
 
16
- def initialize(cid, body)
16
+ def initialize(cid, body_data)
17
17
  @cid = cid
18
- @body = body
18
+ @body_data = body_data
19
+ end
20
+
21
+ def body
22
+ @body ||= CarArchive.convert_data(CBOR.decode(@body_data))
19
23
  end
20
24
  end
21
25
 
@@ -37,9 +41,7 @@ module Skyfall
37
41
  section && section.body
38
42
  end
39
43
 
40
- private
41
-
42
- def convert_data(object)
44
+ def self.convert_data(object)
43
45
  if object.is_a?(Hash)
44
46
  object.each do |k, v|
45
47
  if v.is_a?(Hash) || v.is_a?(Array)
@@ -65,14 +67,16 @@ module Skyfall
65
67
  end
66
68
  end
67
69
 
68
- def make_cid_link(cid)
70
+ def self.make_cid_link(cid)
69
71
  { '$link' => CID.from_cbor_tag(cid) }
70
72
  end
71
73
 
72
- def make_bytes(data)
74
+ def self.make_bytes(data)
73
75
  { '$bytes' => Base64.encode64(data).chomp.gsub(/=+$/, '') }
74
76
  end
75
77
 
78
+ private
79
+
76
80
  def read_header(buffer)
77
81
  len = buffer.read_varint
78
82
 
@@ -112,10 +116,7 @@ module Skyfall
112
116
  cid = CID.new(prefix + cid_data)
113
117
 
114
118
  body_data = sbuffer.read
115
- body = CBOR.decode(body_data)
116
- convert_data(body)
117
-
118
- @sections << CarSection.new(cid, body)
119
+ @sections << CarSection.new(cid, body_data)
119
120
  end
120
121
  end
121
122
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Skyfall
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyfall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Suder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-23 00:00:00.000000000 Z
11
+ date: 2024-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base32