osv 0.3.17 → 0.3.18

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: 4469c67b2a39d9ffa23923e36cd894eac415ca004a432e700102a334af11efd8
4
- data.tar.gz: 8dee3117fe6511b9c5b6005ae37d991891e0f314508986743b659080c7885855
3
+ metadata.gz: da944a5af1cc88630fe0952e6e710d2acb8ac420ae8708a107064f5ecf444dec
4
+ data.tar.gz: bd6de3860ff2f47eb03b9019d307d647fa8c2e8f366543fbe95604f284871b62
5
5
  SHA512:
6
- metadata.gz: d8c94dc1c576cca0043c7501752bdd6dee0c8bf0523d9c99a0e8ab4d614a0eb4e6f087fa62be97bb5816f9998f2c414758ffcab260e90889afada8379fb03aec
7
- data.tar.gz: c51ece65a713af0b351a183415816302fcdc35ad598d0e5ee9e5b693c1ef66826c5dfc3dab90f04499c90e994e590e6dd7121999b5dfe54ce20997e41df0ac02
6
+ metadata.gz: 8a130687fb25aaae3734f2e69c2258ccf893c584cd0c2893b751282b393ee4d52b2317a338f1ef68a864222e4947614ffdca7e6b98d8d37dc934dfede61f7bc1
7
+ data.tar.gz: 332a5dc1c6ce6df721b22f9e66b54d48426da3a0148917f9ec13036edd63e1fb70a950a2971964d289e076536af47d090c89fd95961d8ca4b51f1f1b8a221a98
data/README.md CHANGED
@@ -142,34 +142,34 @@ OSV - Gzipped Direct 1.000 i/100ms
142
142
  FastCSV - Gzipped 1.000 i/100ms
143
143
  CSV - Gzipped 1.000 i/100ms
144
144
  Calculating -------------------------------------
145
- CSV - StringIO 0.080 (± 0.0%) i/s (12.43 s/i) - 3.000 in 37.301114s
146
- FastCSV - StringIO 0.368 (± 0.0%) i/s (2.72 s/i) - 12.000 in 32.619020s
147
- OSV - StringIO 0.699 (± 0.0%) i/s (1.43 s/i) - 21.000 in 30.091225s
148
- CSV - Hash output 0.059 (± 0.0%) i/s (16.95 s/i) - 2.000 in 33.908533s
149
- OSV - Hash output 0.329 (± 0.0%) i/s (3.04 s/i) - 10.000 in 30.551275s
150
- CSV - Array output 0.066 (± 0.0%) i/s (15.18 s/i) - 2.000 in 30.357327s
151
- OSV - Array output 0.632 (± 0.0%) i/s (1.58 s/i) - 19.000 in 30.150113s
145
+ CSV - StringIO 0.083 (± 0.0%) i/s (12.06 s/i) - 3.000 in 36.304469s
146
+ FastCSV - StringIO 0.335 (± 0.0%) i/s (2.98 s/i) - 10.000 in 31.019521s
147
+ OSV - StringIO 0.705 (± 0.0%) i/s (1.42 s/i) - 21.000 in 30.629511s
148
+ CSV - Hash output 0.060 (± 0.0%) i/s (16.74 s/i) - 2.000 in 33.475977s
149
+ OSV - Hash output 0.434 (± 0.0%) i/s (2.30 s/i) - 13.000 in 30.071679s
150
+ CSV - Array output 0.063 (± 0.0%) i/s (15.88 s/i) - 2.000 in 32.229906s
151
+ OSV - Array output 0.406 (± 0.0%) i/s (2.47 s/i) - 12.000 in 31.072600s
152
152
  FastCSV - Array output
153
- 0.350 (± 0.0%) i/s (2.86 s/i) - 11.000 in 31.477268s
153
+ 0.321 (± 0.0%) i/s (3.11 s/i) - 10.000 in 31.458966s
154
154
  OSV - Direct Open Array output
155
- 0.641 (± 0.0%) i/s (1.56 s/i) - 20.000 in 31.275201s
156
- OSV - Gzipped 0.530 (± 0.0%) i/s (1.89 s/i) - 16.000 in 30.183753s
157
- OSV - Gzipped Direct 0.727 (± 0.0%) i/s (1.37 s/i) - 22.000 in 30.283991s
158
- FastCSV - Gzipped 0.323 (± 0.0%) i/s (3.09 s/i) - 10.000 in 30.949600s
159
- CSV - Gzipped 0.056 (± 0.0%) i/s (17.72 s/i) - 2.000 in 35.440473s
155
+ 0.686 (± 0.0%) i/s (1.46 s/i) - 21.000 in 30.639715s
156
+ OSV - Gzipped 0.524 (± 0.0%) i/s (1.91 s/i) - 16.000 in 30.695259s
157
+ OSV - Gzipped Direct 0.519 (± 0.0%) i/s (1.93 s/i) - 16.000 in 30.830005s
158
+ FastCSV - Gzipped 0.313 (± 0.0%) i/s (3.20 s/i) - 10.000 in 32.031002s
159
+ CSV - Gzipped 0.057 (± 0.0%) i/s (17.55 s/i) - 2.000 in 35.107808s
160
160
 
161
161
  Comparison:
162
- OSV - Gzipped Direct: 0.7 i/s
163
- OSV - StringIO: 0.7 i/s - 1.04x slower
164
- OSV - Direct Open Array output: 0.6 i/s - 1.14x slower
165
- OSV - Array output: 0.6 i/s - 1.15x slower
166
- OSV - Gzipped: 0.5 i/s - 1.37x slower
167
- FastCSV - StringIO: 0.4 i/s - 1.98x slower
168
- FastCSV - Array output: 0.3 i/s - 2.08x slower
169
- OSV - Hash output: 0.3 i/s - 2.21x slower
170
- FastCSV - Gzipped: 0.3 i/s - 2.25x slower
171
- CSV - StringIO: 0.1 i/s - 9.04x slower
172
- CSV - Array output: 0.1 i/s - 11.04x slower
173
- CSV - Hash output: 0.1 i/s - 12.33x slower
174
- CSV - Gzipped: 0.1 i/s - 12.89x slower
162
+ OSV - StringIO : 0.7 i/s
163
+ OSV - Direct Open Array output: 0.7 i/s - 1.03x slower
164
+ OSV - Gzipped : 0.5 i/s - 1.34x slower
165
+ OSV - Gzipped Direct : 0.5 i/s - 1.36x slower
166
+ OSV - Hash output : 0.4 i/s - 1.62x slower
167
+ OSV - Array output : 0.4 i/s - 1.74x slower
168
+ FastCSV - StringIO : 0.3 i/s - 2.10x slower
169
+ FastCSV - Array output : 0.3 i/s - 2.20x slower
170
+ FastCSV - Gzipped : 0.3 i/s - 2.26x slower
171
+ CSV - StringIO : 0.1 i/s - 8.50x slower
172
+ CSV - Array output : 0.1 i/s - 11.20x slower
173
+ CSV - Hash output : 0.1 i/s - 11.80x slower
174
+ CSV - Gzipped : 0.1 i/s - 12.37x slower
175
175
  ```
data/ext/osv/src/utils.rs CHANGED
@@ -47,14 +47,14 @@ pub fn parse_read_csv_args(ruby: &Ruby, args: &[Value]) -> Result<ReadCsvArgs, E
47
47
  _,
48
48
  (),
49
49
  (
50
- Option<bool>,
51
- Option<String>,
52
- Option<String>,
50
+ Option<Option<bool>>,
53
51
  Option<Option<String>>,
54
- Option<Value>,
55
- Option<bool>,
56
52
  Option<Option<String>>,
57
- Option<Value>,
53
+ Option<Option<String>>,
54
+ Option<Option<Value>>,
55
+ Option<Option<bool>>,
56
+ Option<Option<Option<String>>>,
57
+ Option<Option<Value>>,
58
58
  ),
59
59
  (),
60
60
  >(
@@ -72,11 +72,12 @@ pub fn parse_read_csv_args(ruby: &Ruby, args: &[Value]) -> Result<ReadCsvArgs, E
72
72
  ],
73
73
  )?;
74
74
 
75
- let has_headers = kwargs.optional.0.unwrap_or(true);
75
+ let has_headers = kwargs.optional.0.flatten().unwrap_or(true);
76
76
 
77
77
  let delimiter = *kwargs
78
78
  .optional
79
79
  .1
80
+ .flatten()
80
81
  .unwrap_or_else(|| ",".to_string())
81
82
  .as_bytes()
82
83
  .first()
@@ -90,6 +91,7 @@ pub fn parse_read_csv_args(ruby: &Ruby, args: &[Value]) -> Result<ReadCsvArgs, E
90
91
  let quote_char = *kwargs
91
92
  .optional
92
93
  .2
94
+ .flatten()
93
95
  .unwrap_or_else(|| "\"".to_string())
94
96
  .as_bytes()
95
97
  .first()
@@ -105,6 +107,7 @@ pub fn parse_read_csv_args(ruby: &Ruby, args: &[Value]) -> Result<ReadCsvArgs, E
105
107
  let result_type = match kwargs
106
108
  .optional
107
109
  .4
110
+ .flatten()
108
111
  .map(|value| parse_string_or_symbol(ruby, value))
109
112
  {
110
113
  Some(Ok(Some(parsed))) => match parsed.as_str() {
@@ -126,13 +129,14 @@ pub fn parse_read_csv_args(ruby: &Ruby, args: &[Value]) -> Result<ReadCsvArgs, E
126
129
  None => String::from("hash"),
127
130
  };
128
131
 
129
- let flexible = kwargs.optional.5.unwrap_or_default();
132
+ let flexible = kwargs.optional.5.flatten().unwrap_or_default();
130
133
 
131
- let flexible_default = kwargs.optional.6.unwrap_or_default();
134
+ let flexible_default = kwargs.optional.6.flatten().unwrap_or_default();
132
135
 
133
136
  let trim = match kwargs
134
137
  .optional
135
138
  .7
139
+ .flatten()
136
140
  .map(|value| parse_string_or_symbol(ruby, value))
137
141
  {
138
142
  Some(Ok(Some(parsed))) => match parsed.as_str() {
data/lib/osv/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OSV
2
- VERSION = "0.3.17"
2
+ VERSION = "0.3.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.17
4
+ version: 0.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Jaremko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-06 00:00:00.000000000 Z
11
+ date: 2025-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys