smart_schema 0.6.0 → 0.7.0

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: 89347fe2acb38785b58cb21628ddf5bec2512d7be25210a45c1295366e0cf425
4
- data.tar.gz: fab7f7ec14eef73b8706a90c20d0e64ade3fb94b13679e67e88c35e7974664bd
3
+ metadata.gz: 027d45dbb44df86b67e3ddc73b11f045630f54d7b9e02cb797ef58afd1bead0f
4
+ data.tar.gz: 35a7394123713a17fa5ef021a7f17ad6fe9667daf88780a981e89a5470bcaefc
5
5
  SHA512:
6
- metadata.gz: c300a0c4cf87e8f6129b0752fc1e2832a0eeafe209ee8d9ef34adca543174ee3c5c5a1e4fdfd0838bc0a11e4f5326eba31b840b3dc814f3b9d3be0bfec207459
7
- data.tar.gz: e6279e1ef40881cfe40356d963a897b7cd34ebd2d5ff5b90a149c58192568c9480c643982872b75222c766e876a82459abc7c69b1f420d33f52ab9b6c21532fb
6
+ metadata.gz: 0d214fb0bd2cfca61d373c48a426ae55d027ef1955a0f718f74303f209bf7aea6a164ab79b4718bdca1bb5d18aa2ad00f8e6fe8f7ec107284dfe753931915df1
7
+ data.tar.gz: 80be7069b581290cf95223272662c17f5b2058defe11d5d2ff09d13952af0fd36006ca383ccda7c2dbc163533076d34a3c6c1693699740299d38eb466dc9bfd0
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ # [0.7.0] - 2022-09-28
5
+ ## Changed
6
+ - Started the total code refactoring in order to decrease object and memory allocations:
7
+ - Decreased object allocations in `SmartCore::Schema::Checker::VerifiableHash#fetch(key)`
8
+
4
9
  # [0.6.0] - 2022-09-27
5
10
  ## Added
6
11
  - Now `Forwardable` module has explicit requiring in order to support *Ruby@3.1* (`lib/smart_core/smart_schema.rb#6`);
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_schema (0.5.0)
4
+ smart_schema (0.7.0)
5
5
  smart_engine (~> 0.11)
6
6
  smart_types (~> 0.4)
7
7
 
@@ -83,8 +83,8 @@ GEM
83
83
  simplecov_json_formatter (~> 0.1)
84
84
  simplecov-html (0.12.3)
85
85
  simplecov_json_formatter (0.1.2)
86
- smart_engine (0.11.0)
87
- smart_types (0.4.0)
86
+ smart_engine (0.12.0)
87
+ smart_types (0.7.1)
88
88
  smart_engine (~> 0.11)
89
89
  tzinfo (2.0.4)
90
90
  concurrent-ruby (~> 1.0)
@@ -104,4 +104,4 @@ DEPENDENCIES
104
104
  smart_schema!
105
105
 
106
106
  BUNDLED WITH
107
- 2.2.3
107
+ 2.3.0.dev
@@ -2,6 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
+ # @version 0.7.0
5
6
  class SmartCore::Schema::Checker::VerifiableHash
6
7
  # @return [Hash<String|Symbol,Any>]
7
8
  #
@@ -50,14 +51,16 @@ class SmartCore::Schema::Checker::VerifiableHash
50
51
  #
51
52
  # @api private
52
53
  # @since 0.1.0
54
+ # @version 0.7.0
53
55
  def fetch(key)
54
56
  # rubocop:disable Style/RedundantBegin
55
57
  @lock.synchronize do
56
- begin
57
- source.fetch(key)
58
- rescue KeyError
59
- source.fetch(key.to_sym)
60
- end
58
+ # @note
59
+ # Previously we used exceptional flow "hash.fetch(key) rescue hash.fetch(key.to_sym)".
60
+ # This flow can generate a lot of useless objects during rescuable `KeyError` exception
61
+ # (useless error messages, backtraces, etc, object that was silently suppressed).
62
+ # So, the "if"-#key?-oriented flow is better (generates fewer number of objects statistically).
63
+ source.key?(key) ? source.fetch(key) : source.fetch(key.to_sym)
61
64
  end
62
65
  # rubocop:enable Style/RedundantBegin
63
66
  end
@@ -7,8 +7,8 @@ module SmartCore
7
7
  #
8
8
  # @api public
9
9
  # @since 0.1.0
10
- # @version 0.6.0
11
- VERSION = '0.6.0'
10
+ # @version 0.7.0
11
+ VERSION = '0.7.0'
12
12
  end
13
13
  # rubocop:enable Style/StaticClass
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-27 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smart_engine