optify-config 1.4.0-x86_64-linux → 1.4.1-x86_64-linux

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: 34d4942fdd16516b838755a6588d185813b39895287972000ea72919249c8349
4
- data.tar.gz: aa1a4f179fe266262a52d60b5805d825b377b512bfd74d9f0647601bcff1049b
3
+ metadata.gz: 4e8f2ea00313d025e288dafa0a021ddcb0953d41c89261828e84a7f8952a229e
4
+ data.tar.gz: 8fc98d221e05d2ce9ed08a0bfc8de716cc19301a7d09d627e87283eb53f5c015
5
5
  SHA512:
6
- metadata.gz: 01ee18fceeaff83882ceb2d14eb77da5e2804355cd47c4c138789806cc34e707472d03ff5c594b29d063f0509f3ed4fdab684b270be30733f7d9e1691917e777
7
- data.tar.gz: d5546a15c032e7149646aedbc52449c73858e253c6c7d754b1df96ea2489ea18fb4253ba1e4880c3fb0da5dc5fc7b2080ccd14df42a8a0d61119491089ab8656
6
+ metadata.gz: 0fc8dada15e7f8efef6e78063cf1a02c8539180efa594c0d79ffd1105e0c964910c3ab25158be542b761f1cf363ebf209b967da59926d81d8c44766f89227431
7
+ data.tar.gz: 2ffbcc06e1158d8b6584f1bd850c3af16a0cfe0f0ec34c804ede6d31cf11651f72560bc207f2188063aa6d309364a44cdea9265b069f6d1d9a5d33fd277816f0
Binary file
Binary file
@@ -11,7 +11,7 @@ module Optify
11
11
  #: (Array[String] feature_names) -> Array[String]
12
12
  def get_canonical_feature_names(feature_names)
13
13
  # Try to optimize a typical case where there are just a few features.
14
- # Ideally in production, a single feature that imports many other features is used for the most common scenario.
14
+ # Ideally in production, a single feature that imports many other features is used for the most common scenarios.
15
15
  # Benchmarks show that it is faster to use a loop than to call the Rust implementation which involves making a `Vec<String>` and returning a `Vec<String>`.
16
16
  if feature_names.length < 4
17
17
  feature_names.map { |feature_name| get_canonical_feature_name(feature_name) }
@@ -93,19 +93,25 @@ module Optify
93
93
  end
94
94
 
95
95
  init unless @cache
96
- unless preferences&.skip_feature_name_conversion
97
- # When there are just a few names, then it can be faster to convert them one by one in a loop to avoid working with an array in Rust.
98
- # When there are over 7 names, then it is faster to convert them with one call to Rust.
99
- feature_names = get_canonical_feature_names(feature_names)
100
- end
96
+ feature_names = get_canonical_feature_names(feature_names) unless preferences&.skip_feature_name_conversion
101
97
 
102
98
  cache_key = [key, feature_names, config_class]
103
99
  result = @cache&.fetch(cache_key, NOT_FOUND_IN_CACHE_SENTINEL)
104
100
  return result unless result.equal?(NOT_FOUND_IN_CACHE_SENTINEL)
105
101
 
106
- # TODO: Copy the preferences to avoid mutating the original object.
107
- preferences ||= GetOptionsPreferences.new
108
- preferences.skip_feature_name_conversion = true
102
+ # Handle a cache miss.
103
+
104
+ # We can avoid converting the features names because they're already converted, if that was desired.
105
+ if preferences.nil?
106
+ preferences = GetOptionsPreferences.new
107
+ preferences.skip_feature_name_conversion = true
108
+ else
109
+ # Indeed the copying of preferences could be wasteful, but this only happens on a cache miss
110
+ # and when no custom preferences are provided.
111
+ preferences = preferences.dup
112
+ preferences.skip_feature_name_conversion = true
113
+ end
114
+
109
115
  result = get_options(key, feature_names, config_class, nil, preferences)
110
116
 
111
117
  T.must(@cache)[cache_key] = result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optify-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Justin D. Harris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-09 00:00:00.000000000 Z
11
+ date: 2025-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.11911
19
+ version: 0.5.12083
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.11911
26
+ version: 0.5.12083
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake-compiler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.9
33
+ version: 1.3.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.9
40
+ version: 1.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rbs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.9.2
47
+ version: 3.9.3
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.9.2
54
+ version: 3.9.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sorbet
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.11911
61
+ version: 0.5.12083
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.5.11911
68
+ version: 0.5.12083
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tapioca
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 3.6.7
89
+ version: 3.6.8
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 3.6.7
96
+ version: 3.6.8
97
97
  description: |-
98
98
  Simplifies getting the right configuration options for a process using pre-loaded configurations
99
99
  from files to manage options for experiments or flights.