serialbench 0.3.1 → 0.5.0
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 +4 -4
- data/.github/workflows/benchmark.yml +0 -24
- data/.github/workflows/rake.yml +15 -18
- data/Gemfile +1 -1
- data/config/benchmarks/full-json.yml +2 -2
- data/config/benchmarks/full-toml.yml +2 -2
- data/config/benchmarks/full-xml.yml +2 -2
- data/config/benchmarks/full-yaml.yml +2 -2
- data/config/benchmarks/full.yml +2 -2
- data/config/benchmarks/short.yml +2 -2
- data/lib/serialbench/benchmark_runner.rb +21 -296
- data/lib/serialbench/cli/benchmark_cli.rb +8 -81
- data/lib/serialbench/cli.rb +0 -5
- data/lib/serialbench/models/benchmark_config.rb +1 -1
- data/lib/serialbench/models/result_store.rb +0 -38
- data/lib/serialbench/models.rb +0 -5
- data/lib/serialbench/serializers/base_serializer.rb +0 -4
- data/lib/serialbench/serializers/json/base_json_serializer.rb +8 -20
- data/lib/serialbench/serializers/json/json_serializer.rb +0 -16
- data/lib/serialbench/serializers/json/oj_serializer.rb +2 -17
- data/lib/serialbench/serializers/json/yajl_serializer.rb +2 -2
- data/lib/serialbench/serializers/toml/base_toml_serializer.rb +8 -29
- data/lib/serialbench/serializers/toml/toml_rb_serializer.rb +0 -16
- data/lib/serialbench/serializers/toml/tomlib_serializer.rb +0 -4
- data/lib/serialbench/serializers/toml/tomlrb_serializer.rb +2 -18
- data/lib/serialbench/serializers/xml/base_xml_serializer.rb +4 -16
- data/lib/serialbench/serializers/xml/leptris_serializer.rb +1 -5
- data/lib/serialbench/serializers/xml/libxml_serializer.rb +4 -9
- data/lib/serialbench/serializers/xml/nokogiri_serializer.rb +3 -3
- data/lib/serialbench/serializers/xml/oga_serializer.rb +3 -5
- data/lib/serialbench/serializers/xml/ox_serializer.rb +2 -2
- data/lib/serialbench/serializers/xml/rexml_serializer.rb +5 -12
- data/lib/serialbench/serializers/yaml/base_yaml_serializer.rb +1 -9
- data/lib/serialbench/serializers/yaml/syck_serializer.rb +0 -8
- data/lib/serialbench/test_data.rb +315 -0
- data/lib/serialbench/version.rb +1 -1
- data/lib/serialbench.rb +2 -1
- data/serialbench.gemspec +1 -2
- metadata +6 -23
- data/.github/workflows/windows-debug.yml +0 -171
- data/lib/serialbench/cli/resultset_cli.rb +0 -301
- data/lib/serialbench/models/result_set.rb +0 -79
- data/lib/serialbench/site_generator.rb +0 -337
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7267d278bec24e38ca217bfbf164c10411f03b4fb333295f05c617c56f91a8b8
|
|
4
|
+
data.tar.gz: fcf4034a75ee9615197e2fd0cd3e7b63a795c7f3f0b1ba2c3b1cd0170babecb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4acd59cfc6d0b8d47d1d09172ea2f034063633ba5435fccc2fcfbd35ec11d96d41080210d84d149423979b3e14873cf3833512d36917515dfdb0ccdb698dfc1f
|
|
7
|
+
data.tar.gz: a913c26df13272e009996925fc6dd4789f74c6f968d27cd02da6155b71f1026d03e8bc2bb1cef1ba400ca19170b3c5a7f0d04ab125658ebf8a54c14551c5607b
|
|
@@ -3,11 +3,7 @@ name: benchmark-weekly
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches: [main]
|
|
6
|
-
paths-ignore:
|
|
7
|
-
- '.github/workflows/windows-debug.yml'
|
|
8
6
|
pull_request:
|
|
9
|
-
paths-ignore:
|
|
10
|
-
- '.github/workflows/windows-debug.yml'
|
|
11
7
|
schedule:
|
|
12
8
|
# Run benchmarks weekly on Sundays at 2 AM UTC
|
|
13
9
|
- cron: '0 2 * * 0'
|
|
@@ -111,26 +107,6 @@ jobs:
|
|
|
111
107
|
- name: Install gems
|
|
112
108
|
run: bundle install
|
|
113
109
|
|
|
114
|
-
- name: Build libleptris from source (Ubuntu 22.04)
|
|
115
|
-
if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-22.04-arm'
|
|
116
|
-
run: |
|
|
117
|
-
LEPTRIS_VERSION=$(bundle exec ruby -e "print Gem::Specification.find_by_name('leptris').version")
|
|
118
|
-
LEPTRIS_TAG=$(curl -s "https://api.github.com/repos/leptris/leptris/tags?per_page=100" \
|
|
119
|
-
| grep -oE '"v[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"' | sort -V \
|
|
120
|
-
| awk -v v="v${LEPTRIS_VERSION}" '$0 <= v' | tail -1)
|
|
121
|
-
echo "Building libleptris ${LEPTRIS_VERSION} from tag ${LEPTRIS_TAG}"
|
|
122
|
-
test -n "${LEPTRIS_TAG}"
|
|
123
|
-
curl -sL "https://github.com/leptris/leptris/archive/refs/tags/${LEPTRIS_TAG}.tar.gz" | tar xz
|
|
124
|
-
ln -s "leptris-${LEPTRIS_TAG#v}" "leptris-${LEPTRIS_VERSION}"
|
|
125
|
-
cmake -S "leptris-${LEPTRIS_VERSION}" -B /tmp/leptris-build \
|
|
126
|
-
-DLEPTRIS_BUILD_SHARED=ON -DLEPTRIS_BUILD_STATIC=OFF -DBUILD_TESTING=OFF \
|
|
127
|
-
-DLEPTRIS_BUILD_CLI=OFF -DLEPTRIS_BUILD_BENCHMARKS=OFF -DLEPTRIS_BUILD_MAN_PAGES=OFF \
|
|
128
|
-
-DLEPTRIS_ENABLE_UTF8PROC=OFF -DLEPTRIS_ENABLE_ICONV=OFF
|
|
129
|
-
cmake --build /tmp/leptris-build -j"$(nproc)"
|
|
130
|
-
LIBLEPTRIS=$(find /tmp/leptris-build -name 'libleptris.so*' -type f | head -1)
|
|
131
|
-
echo "LEPTRIS_LIB_PATH=${LIBLEPTRIS}" >> "$GITHUB_ENV"
|
|
132
|
-
shell: bash
|
|
133
|
-
|
|
134
110
|
- name: Create environment config
|
|
135
111
|
run: |
|
|
136
112
|
mkdir -p config/environments
|
data/.github/workflows/rake.yml
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
1
|
name: rake
|
|
4
2
|
|
|
5
3
|
on:
|
|
6
4
|
push:
|
|
7
|
-
branches: [
|
|
5
|
+
branches: [ main ]
|
|
8
6
|
tags: [ v* ]
|
|
9
|
-
paths-ignore:
|
|
10
|
-
- '.github/workflows/windows-debug.yml'
|
|
11
7
|
pull_request:
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
14
11
|
|
|
15
12
|
jobs:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
rspec:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: '3.4'
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
|
|
23
|
+
- run: bundle exec rspec --format progress
|
data/Gemfile
CHANGED
|
@@ -12,7 +12,7 @@ unless Gem.win_platform? && RUBY_PLATFORM.include?('aarch64')
|
|
|
12
12
|
gem 'libxml-ruby'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
gem 'leptris', '1.9.
|
|
15
|
+
gem 'leptris', '1.9.35' # precompiled platform gems bundle libleptris (darwin/linux/mingw)
|
|
16
16
|
gem 'benchmark' # Removed from stdlib in Ruby 4.0
|
|
17
17
|
gem 'base64' # Required for Ruby 3.4+
|
|
18
18
|
gem 'lutaml-model', '~> 0.7'
|
data/config/benchmarks/full.yml
CHANGED
data/config/benchmarks/short.yml
CHANGED
|
@@ -21,6 +21,7 @@ module Serialbench
|
|
|
21
21
|
@serializers = Serializers.available
|
|
22
22
|
@test_data = {}
|
|
23
23
|
@results = []
|
|
24
|
+
validate_operations!
|
|
24
25
|
load_test_data
|
|
25
26
|
end
|
|
26
27
|
|
|
@@ -45,11 +46,13 @@ module Serialbench
|
|
|
45
46
|
puts "Test data sizes: #{@test_data.keys.join(', ')}"
|
|
46
47
|
puts
|
|
47
48
|
|
|
49
|
+
selected = @benchmark_config.operations
|
|
50
|
+
selected = OPERATIONS.keys + ['memory'] if selected.nil? || selected.empty?
|
|
48
51
|
results = {}
|
|
49
52
|
OPERATIONS.each do |name, handler|
|
|
50
|
-
results[name.to_sym] = run_benchmark_type(name, name, &handler)
|
|
53
|
+
results[name.to_sym] = selected.include?(name) ? run_benchmark_type(name, name, &handler) : []
|
|
51
54
|
end
|
|
52
|
-
results[:memory] = run_memory_benchmarks
|
|
55
|
+
results[:memory] = selected.include?('memory') ? run_memory_benchmarks : []
|
|
53
56
|
|
|
54
57
|
Models::BenchmarkResult.new(
|
|
55
58
|
serializers: Serializers.information,
|
|
@@ -145,313 +148,35 @@ module Serialbench
|
|
|
145
148
|
|
|
146
149
|
case type_name
|
|
147
150
|
when 'generation'
|
|
148
|
-
serializers.select(
|
|
151
|
+
serializers.select { |s| s.supports?(:generate) }
|
|
149
152
|
when 'streaming'
|
|
150
|
-
serializers.select(
|
|
153
|
+
serializers.select { |s| s.supports?(:sax) || s.supports?(:streaming) }
|
|
154
|
+
when 'xpath'
|
|
155
|
+
serializers.select { |s| s.supports?(:xpath) }
|
|
151
156
|
else
|
|
152
157
|
serializers
|
|
153
158
|
end
|
|
154
159
|
end
|
|
155
160
|
|
|
156
161
|
def get_iterations_for_size(size)
|
|
157
|
-
@benchmark_config.iterations
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
# Initialize test data structure
|
|
165
|
-
@test_data = {}
|
|
166
|
-
data_sizes.each { |size| @test_data[size] = {} }
|
|
167
|
-
|
|
168
|
-
# Generate data for each format and size
|
|
169
|
-
@benchmark_config.formats.each do |format|
|
|
170
|
-
data_sizes.each do |size|
|
|
171
|
-
@test_data[size][format] = generate_test_data(format, size)
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
# Try to load real test files if they exist
|
|
176
|
-
data_sizes.each do |size|
|
|
177
|
-
@benchmark_config.formats.each do |format|
|
|
178
|
-
file_path = "test_data/#{size}.#{format}"
|
|
179
|
-
@test_data[size][format] = File.read(file_path) if File.exist?(file_path)
|
|
180
|
-
end
|
|
162
|
+
iterations = @benchmark_config.iterations
|
|
163
|
+
case size.to_s
|
|
164
|
+
when 'small' then iterations.small
|
|
165
|
+
when 'medium' then iterations.medium
|
|
166
|
+
when 'large' then iterations.large
|
|
167
|
+
else raise ArgumentError, "no iteration count configured for #{size}"
|
|
181
168
|
end
|
|
182
169
|
end
|
|
183
170
|
|
|
184
|
-
def
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
# Shared data structure generators
|
|
190
|
-
def small_test_data_structure
|
|
191
|
-
{
|
|
192
|
-
config: {
|
|
193
|
-
database: {
|
|
194
|
-
host: 'localhost',
|
|
195
|
-
port: 5432,
|
|
196
|
-
name: 'myapp',
|
|
197
|
-
user: 'admin',
|
|
198
|
-
password: 'secret'
|
|
199
|
-
},
|
|
200
|
-
cache: {
|
|
201
|
-
enabled: true,
|
|
202
|
-
ttl: 3600
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
def medium_test_data_structure
|
|
209
|
-
{
|
|
210
|
-
users: (1..1000).map do |i|
|
|
211
|
-
{
|
|
212
|
-
id: i,
|
|
213
|
-
name: "User #{i}",
|
|
214
|
-
email: "user#{i}@example.com",
|
|
215
|
-
created_at: "2023-01-#{(i % 28) + 1}T10:00:00Z",
|
|
216
|
-
profile: {
|
|
217
|
-
age: 20 + (i % 50),
|
|
218
|
-
city: "City #{i % 100}",
|
|
219
|
-
preferences: {
|
|
220
|
-
theme: i.even? ? 'dark' : 'light',
|
|
221
|
-
notifications: (i % 3).zero?
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
end
|
|
226
|
-
}
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
def large_test_data_structure
|
|
230
|
-
{
|
|
231
|
-
dataset: {
|
|
232
|
-
header: {
|
|
233
|
-
created: '2023-01-01T00:00:00Z',
|
|
234
|
-
count: 10_000,
|
|
235
|
-
format: 'data'
|
|
236
|
-
},
|
|
237
|
-
records: (1..10_000).map do |i|
|
|
238
|
-
{
|
|
239
|
-
id: i,
|
|
240
|
-
timestamp: "2023-01-01T#{format('%02d', i % 24)}:#{format('%02d', i % 60)}:#{format('%02d', i % 60)}Z",
|
|
241
|
-
data: {
|
|
242
|
-
field1: "Value #{i}",
|
|
243
|
-
field2: i * 2,
|
|
244
|
-
field3: (i % 100).zero? ? 'special' : 'normal',
|
|
245
|
-
nested: [
|
|
246
|
-
"Item #{i}-1",
|
|
247
|
-
"Item #{i}-2",
|
|
248
|
-
"Item #{i}-3"
|
|
249
|
-
]
|
|
250
|
-
},
|
|
251
|
-
metadata: {
|
|
252
|
-
source: 'generator',
|
|
253
|
-
version: '1.0',
|
|
254
|
-
checksum: i.to_s(16)
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
end
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
end
|
|
261
|
-
|
|
262
|
-
# XML test data generators
|
|
263
|
-
def generate_small_xml
|
|
264
|
-
data = small_test_data_structure
|
|
265
|
-
<<~XML
|
|
266
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
267
|
-
<config>
|
|
268
|
-
<database>
|
|
269
|
-
<host>#{data[:config][:database][:host]}</host>
|
|
270
|
-
<port>#{data[:config][:database][:port]}</port>
|
|
271
|
-
<name>#{data[:config][:database][:name]}</name>
|
|
272
|
-
<user>#{data[:config][:database][:user]}</user>
|
|
273
|
-
<password>#{data[:config][:database][:password]}</password>
|
|
274
|
-
</database>
|
|
275
|
-
<cache>
|
|
276
|
-
<enabled>#{data[:config][:cache][:enabled]}</enabled>
|
|
277
|
-
<ttl>#{data[:config][:cache][:ttl]}</ttl>
|
|
278
|
-
</cache>
|
|
279
|
-
</config>
|
|
280
|
-
XML
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
def generate_medium_xml
|
|
284
|
-
data = medium_test_data_structure
|
|
285
|
-
users = data[:users].map do |user|
|
|
286
|
-
<<~USER
|
|
287
|
-
<user id="#{user[:id]}">
|
|
288
|
-
<name>#{user[:name]}</name>
|
|
289
|
-
<email>#{user[:email]}</email>
|
|
290
|
-
<created_at>#{user[:created_at]}</created_at>
|
|
291
|
-
<profile>
|
|
292
|
-
<age>#{user[:profile][:age]}</age>
|
|
293
|
-
<city>#{user[:profile][:city]}</city>
|
|
294
|
-
<preferences>
|
|
295
|
-
<theme>#{user[:profile][:preferences][:theme]}</theme>
|
|
296
|
-
<notifications>#{user[:profile][:preferences][:notifications]}</notifications>
|
|
297
|
-
</preferences>
|
|
298
|
-
</profile>
|
|
299
|
-
</user>
|
|
300
|
-
USER
|
|
301
|
-
end.join
|
|
302
|
-
|
|
303
|
-
<<~XML
|
|
304
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
305
|
-
<users>
|
|
306
|
-
#{users}
|
|
307
|
-
</users>
|
|
308
|
-
XML
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
def generate_large_xml
|
|
312
|
-
data = large_test_data_structure
|
|
313
|
-
records = data[:dataset][:records].map do |record|
|
|
314
|
-
nested_items = record[:data][:nested].map { |item| " <item>#{item}</item>" }.join("\n")
|
|
315
|
-
<<~RECORD
|
|
316
|
-
<record id="#{record[:id]}">
|
|
317
|
-
<timestamp>#{record[:timestamp]}</timestamp>
|
|
318
|
-
<data>
|
|
319
|
-
<field1>#{record[:data][:field1]}</field1>
|
|
320
|
-
<field2>#{record[:data][:field2]}</field2>
|
|
321
|
-
<field3>#{record[:data][:field3]}</field3>
|
|
322
|
-
<nested>
|
|
323
|
-
#{nested_items}
|
|
324
|
-
</nested>
|
|
325
|
-
</data>
|
|
326
|
-
<metadata>
|
|
327
|
-
<source>#{record[:metadata][:source]}</source>
|
|
328
|
-
<version>#{record[:metadata][:version]}</version>
|
|
329
|
-
<checksum>#{record[:metadata][:checksum]}</checksum>
|
|
330
|
-
</metadata>
|
|
331
|
-
</record>
|
|
332
|
-
RECORD
|
|
333
|
-
end.join
|
|
334
|
-
|
|
335
|
-
<<~XML
|
|
336
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
337
|
-
<dataset>
|
|
338
|
-
<header>
|
|
339
|
-
<created>#{data[:dataset][:header][:created]}</created>
|
|
340
|
-
<count>#{data[:dataset][:header][:count]}</count>
|
|
341
|
-
<format>xml</format>
|
|
342
|
-
</header>
|
|
343
|
-
<records>
|
|
344
|
-
#{records}
|
|
345
|
-
</records>
|
|
346
|
-
</dataset>
|
|
347
|
-
XML
|
|
348
|
-
end
|
|
349
|
-
|
|
350
|
-
# JSON test data generators
|
|
351
|
-
def generate_small_json
|
|
352
|
-
JSON.generate(small_test_data_structure)
|
|
353
|
-
end
|
|
354
|
-
|
|
355
|
-
def generate_medium_json
|
|
356
|
-
JSON.generate(medium_test_data_structure)
|
|
357
|
-
end
|
|
358
|
-
|
|
359
|
-
def generate_large_json
|
|
360
|
-
data = large_test_data_structure
|
|
361
|
-
data[:dataset][:header][:format] = 'json'
|
|
362
|
-
JSON.generate(data)
|
|
363
|
-
end
|
|
364
|
-
|
|
365
|
-
# YAML test data generators
|
|
366
|
-
def generate_small_yaml
|
|
367
|
-
small_test_data_structure.to_yaml
|
|
368
|
-
end
|
|
369
|
-
|
|
370
|
-
def generate_medium_yaml
|
|
371
|
-
medium_test_data_structure.to_yaml
|
|
372
|
-
end
|
|
171
|
+
def validate_operations!
|
|
172
|
+
unknown = (@benchmark_config.operations || []) - (OPERATIONS.keys + ['memory'])
|
|
173
|
+
return if unknown.empty?
|
|
373
174
|
|
|
374
|
-
|
|
375
|
-
data = large_test_data_structure
|
|
376
|
-
data[:dataset][:header][:format] = 'yaml'
|
|
377
|
-
data.to_yaml
|
|
175
|
+
raise ArgumentError, "unknown operations #{unknown.inspect}; expected: #{OPERATIONS.keys.join(', ')}, memory"
|
|
378
176
|
end
|
|
379
177
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
data = small_test_data_structure
|
|
383
|
-
<<~TOML
|
|
384
|
-
[config]
|
|
385
|
-
|
|
386
|
-
[config.database]
|
|
387
|
-
host = "#{data[:config][:database][:host]}"
|
|
388
|
-
port = #{data[:config][:database][:port]}
|
|
389
|
-
name = "#{data[:config][:database][:name]}"
|
|
390
|
-
user = "#{data[:config][:database][:user]}"
|
|
391
|
-
password = "#{data[:config][:database][:password]}"
|
|
392
|
-
|
|
393
|
-
[config.cache]
|
|
394
|
-
enabled = #{data[:config][:cache][:enabled]}
|
|
395
|
-
ttl = #{data[:config][:cache][:ttl]}
|
|
396
|
-
TOML
|
|
397
|
-
end
|
|
398
|
-
|
|
399
|
-
def generate_medium_toml
|
|
400
|
-
data = medium_test_data_structure
|
|
401
|
-
# Use smaller dataset for TOML due to verbosity
|
|
402
|
-
users = data[:users].first(100)
|
|
403
|
-
users.map do |user|
|
|
404
|
-
<<~USER
|
|
405
|
-
[[users]]
|
|
406
|
-
id = #{user[:id]}
|
|
407
|
-
name = "#{user[:name]}"
|
|
408
|
-
email = "#{user[:email]}"
|
|
409
|
-
created_at = "#{user[:created_at]}"
|
|
410
|
-
|
|
411
|
-
[users.profile]
|
|
412
|
-
age = #{user[:profile][:age]}
|
|
413
|
-
city = "#{user[:profile][:city]}"
|
|
414
|
-
|
|
415
|
-
[users.profile.preferences]
|
|
416
|
-
theme = "#{user[:profile][:preferences][:theme]}"
|
|
417
|
-
notifications = #{user[:profile][:preferences][:notifications]}
|
|
418
|
-
USER
|
|
419
|
-
end.join("\n")
|
|
420
|
-
end
|
|
421
|
-
|
|
422
|
-
def generate_large_toml
|
|
423
|
-
data = large_test_data_structure
|
|
424
|
-
# Use smaller dataset for TOML due to verbosity
|
|
425
|
-
records = data[:dataset][:records].first(1000)
|
|
426
|
-
records_toml = records.map do |record|
|
|
427
|
-
<<~RECORD
|
|
428
|
-
[[dataset.records]]
|
|
429
|
-
id = #{record[:id]}
|
|
430
|
-
timestamp = "#{record[:timestamp]}"
|
|
431
|
-
|
|
432
|
-
[dataset.records.data]
|
|
433
|
-
field1 = "#{record[:data][:field1]}"
|
|
434
|
-
field2 = #{record[:data][:field2]}
|
|
435
|
-
field3 = "#{record[:data][:field3]}"
|
|
436
|
-
nested = #{record[:data][:nested].inspect}
|
|
437
|
-
|
|
438
|
-
[dataset.records.metadata]
|
|
439
|
-
source = "#{record[:metadata][:source]}"
|
|
440
|
-
version = "#{record[:metadata][:version]}"
|
|
441
|
-
checksum = "#{record[:metadata][:checksum]}"
|
|
442
|
-
RECORD
|
|
443
|
-
end.join("\n")
|
|
444
|
-
|
|
445
|
-
<<~TOML
|
|
446
|
-
[dataset]
|
|
447
|
-
|
|
448
|
-
[dataset.header]
|
|
449
|
-
created = "#{data[:dataset][:header][:created]}"
|
|
450
|
-
count = #{records.length}
|
|
451
|
-
format = "toml"
|
|
452
|
-
|
|
453
|
-
#{records_toml}
|
|
454
|
-
TOML
|
|
178
|
+
def load_test_data
|
|
179
|
+
@test_data = TestData.load(@benchmark_config)
|
|
455
180
|
end
|
|
456
181
|
end
|
|
457
182
|
end
|
|
@@ -284,7 +284,6 @@ module Serialbench
|
|
|
284
284
|
|
|
285
285
|
say '✅ Local benchmark completed successfully!', :green
|
|
286
286
|
say "Results saved to: #{result_dir}", :cyan
|
|
287
|
-
say "Generate site: serialbench benchmark build-site #{result_dir}", :white
|
|
288
287
|
rescue StandardError => e
|
|
289
288
|
say "❌ Local benchmark failed: #{e.message}", :red
|
|
290
289
|
say "Details: #{e.backtrace.first(3).join("\n")}", :white if options[:verbose]
|
|
@@ -308,7 +307,6 @@ module Serialbench
|
|
|
308
307
|
|
|
309
308
|
say '✅ Docker benchmark completed successfully!', :green
|
|
310
309
|
say "Results saved to: #{result_dir}", :cyan
|
|
311
|
-
say "Generate site: serialbench benchmark build-site #{result_dir}", :white
|
|
312
310
|
rescue StandardError => e
|
|
313
311
|
say "❌ Docker benchmark failed: #{e.message}", :red
|
|
314
312
|
say "Details: #{e.backtrace.first(3).join("\n")}", :white if options[:verbose]
|
|
@@ -357,92 +355,21 @@ module Serialbench
|
|
|
357
355
|
exit 1
|
|
358
356
|
end
|
|
359
357
|
|
|
360
|
-
|
|
361
|
-
# say '🏠 Executing local benchmark', :green
|
|
362
|
-
|
|
363
|
-
# # Create benchmark runner with config
|
|
364
|
-
# runner_options = {
|
|
365
|
-
# formats: (config['formats'] || %w[xml json yaml toml]).map(&:to_sym),
|
|
366
|
-
# iterations: config['iterations'] || 10,
|
|
367
|
-
# warmup: config['warmup'] || 3,
|
|
368
|
-
# config: config
|
|
369
|
-
# }
|
|
370
|
-
|
|
371
|
-
# runner = Serialbench::BenchmarkRunner.new(**runner_options)
|
|
372
|
-
|
|
373
|
-
# # Run benchmarks
|
|
374
|
-
# say "Running benchmarks with #{runner_options[:iterations]} iterations...", :white
|
|
375
|
-
# results = runner.run_all_benchmarks
|
|
376
|
-
|
|
377
|
-
# # Create platform-specific directory name using environment's ruby_build_tag
|
|
378
|
-
# require_relative '../models/platform'
|
|
379
|
-
# platform = Serialbench::Models::Platform.current_local
|
|
380
|
-
# platform_string = "local-#{platform.os}-#{platform.arch}-ruby-#{environment['ruby_build_tag']}"
|
|
381
|
-
|
|
382
|
-
# # Create results directory
|
|
383
|
-
# result_dir = "results/runs/#{environment['name']}"
|
|
384
|
-
# FileUtils.mkdir_p(result_dir)
|
|
385
|
-
|
|
386
|
-
# # Save results to single YAML file with platform and metadata merged in
|
|
387
|
-
# results_file = File.join(result_dir, 'results.yaml')
|
|
388
|
-
# full_results = {
|
|
389
|
-
# 'platform' => {
|
|
390
|
-
# 'platform_string' => platform_string,
|
|
391
|
-
# 'os' => platform.os,
|
|
392
|
-
# 'arch' => platform.arch
|
|
393
|
-
# },
|
|
394
|
-
# 'metadata' => {
|
|
395
|
-
# 'environment_name' => environment['name'],
|
|
396
|
-
# 'benchmark_config' => benchmark_config_path,
|
|
397
|
-
# 'created_at' => Time.now.iso8601,
|
|
398
|
-
# 'tags' => ['local', platform.os, platform.arch, "ruby-#{environment['ruby_build_tag']}"]
|
|
399
|
-
# },
|
|
400
|
-
# 'environment' => {
|
|
401
|
-
# 'name' => environment['name'],
|
|
402
|
-
# 'type' => environment.kind,
|
|
403
|
-
# 'ruby_build_tag' => environment['ruby_build_tag'],
|
|
404
|
-
# 'created_at' => Time.now.iso8601
|
|
405
|
-
# },
|
|
406
|
-
# 'config' => {
|
|
407
|
-
# 'benchmark_config' => benchmark_config_path,
|
|
408
|
-
# 'formats' => config['formats'],
|
|
409
|
-
# 'iterations' => config['iterations'],
|
|
410
|
-
# 'data_sizes' => config['data_sizes']
|
|
411
|
-
# },
|
|
412
|
-
# 'results' => results
|
|
413
|
-
# }
|
|
414
|
-
|
|
415
|
-
# File.write(results_file, full_results.to_yaml)
|
|
416
|
-
|
|
417
|
-
# say '✅ Local benchmark completed successfully!', :green
|
|
418
|
-
# say "Results saved to: #{result_dir}", :cyan
|
|
419
|
-
# say "Generate site: serialbench benchmark build-site #{result_dir}", :white
|
|
420
|
-
# rescue StandardError => e
|
|
421
|
-
# say "❌ Local benchmark failed: #{e.message}", :red
|
|
422
|
-
# say "Details: #{e.backtrace.first(3).join("\n")}", :white if options[:verbose]
|
|
423
|
-
# raise e
|
|
424
|
-
# end
|
|
425
|
-
|
|
426
|
-
def execute_asdf_benchmark(environment, _config, benchmark_config_path)
|
|
358
|
+
def execute_asdf_benchmark(environment, config, benchmark_config_path)
|
|
427
359
|
say '🔧 Executing ASDF benchmark', :green
|
|
428
360
|
|
|
429
|
-
|
|
430
|
-
require_relative '../asdf_runner'
|
|
361
|
+
require_relative '../runners/asdf_runner'
|
|
431
362
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
'benchmark_config' => benchmark_config_path
|
|
435
|
-
})
|
|
363
|
+
environment_config_path = "config/environments/#{environment.name}.yml"
|
|
364
|
+
runner = Runners::AsdfRunner.new(environment, environment_config_path)
|
|
436
365
|
|
|
437
|
-
|
|
366
|
+
result_dir = "results/runs/#{environment.name}-results"
|
|
367
|
+
FileUtils.mkdir_p(result_dir)
|
|
438
368
|
|
|
439
|
-
|
|
440
|
-
runner.prepare
|
|
441
|
-
runner.benchmark
|
|
369
|
+
runner.run_benchmark(config, benchmark_config_path, result_dir)
|
|
442
370
|
|
|
443
371
|
say '✅ ASDF benchmark completed successfully!', :green
|
|
444
|
-
say "Results saved to:
|
|
445
|
-
say "Generate site: serialbench benchmark build-site results/runs/#{environment['name']}", :white
|
|
372
|
+
say "Results saved to: #{result_dir}", :cyan
|
|
446
373
|
rescue StandardError => e
|
|
447
374
|
say "❌ ASDF benchmark failed: #{e.message}", :red
|
|
448
375
|
say "Details: #{e.backtrace.first(3).join("\n")}", :white if options[:verbose]
|
data/lib/serialbench/cli.rb
CHANGED
|
@@ -6,7 +6,6 @@ require_relative 'cli/environment_cli'
|
|
|
6
6
|
require_relative 'cli/benchmark_cli'
|
|
7
7
|
require_relative 'cli/ruby_build_cli'
|
|
8
8
|
require_relative 'cli/validate_cli'
|
|
9
|
-
require_relative 'cli/resultset_cli'
|
|
10
9
|
|
|
11
10
|
module Serialbench
|
|
12
11
|
# Main CLI entry point for the new object-oriented command structure
|
|
@@ -58,10 +57,6 @@ module Serialbench
|
|
|
58
57
|
serialbench benchmark create my-benchmark
|
|
59
58
|
serialbench benchmark execute my-benchmark.yml
|
|
60
59
|
|
|
61
|
-
# Create a result set for comparison
|
|
62
|
-
|
|
63
|
-
# Generate static sites
|
|
64
|
-
serialbench benchmark build-site results/my-benchmark
|
|
65
60
|
|
|
66
61
|
For detailed help on any command, use:
|
|
67
62
|
serialbench COMMAND help
|
|
@@ -51,7 +51,7 @@ module Serialbench
|
|
|
51
51
|
attribute :formats, :string, collection: true, values: %w[xml json yaml toml]
|
|
52
52
|
attribute :iterations, BenchmarkIteration
|
|
53
53
|
attribute :warmup, :integer, default: -> { 1 }
|
|
54
|
-
attribute :operations, :string, collection: true, values: %w[
|
|
54
|
+
attribute :operations, :string, collection: true, values: %w[parsing generation xpath streaming memory]
|
|
55
55
|
|
|
56
56
|
key_value do
|
|
57
57
|
map 'name', to: :name
|