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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/benchmark.yml +0 -24
  3. data/.github/workflows/rake.yml +15 -18
  4. data/Gemfile +1 -1
  5. data/config/benchmarks/full-json.yml +2 -2
  6. data/config/benchmarks/full-toml.yml +2 -2
  7. data/config/benchmarks/full-xml.yml +2 -2
  8. data/config/benchmarks/full-yaml.yml +2 -2
  9. data/config/benchmarks/full.yml +2 -2
  10. data/config/benchmarks/short.yml +2 -2
  11. data/lib/serialbench/benchmark_runner.rb +21 -296
  12. data/lib/serialbench/cli/benchmark_cli.rb +8 -81
  13. data/lib/serialbench/cli.rb +0 -5
  14. data/lib/serialbench/models/benchmark_config.rb +1 -1
  15. data/lib/serialbench/models/result_store.rb +0 -38
  16. data/lib/serialbench/models.rb +0 -5
  17. data/lib/serialbench/serializers/base_serializer.rb +0 -4
  18. data/lib/serialbench/serializers/json/base_json_serializer.rb +8 -20
  19. data/lib/serialbench/serializers/json/json_serializer.rb +0 -16
  20. data/lib/serialbench/serializers/json/oj_serializer.rb +2 -17
  21. data/lib/serialbench/serializers/json/yajl_serializer.rb +2 -2
  22. data/lib/serialbench/serializers/toml/base_toml_serializer.rb +8 -29
  23. data/lib/serialbench/serializers/toml/toml_rb_serializer.rb +0 -16
  24. data/lib/serialbench/serializers/toml/tomlib_serializer.rb +0 -4
  25. data/lib/serialbench/serializers/toml/tomlrb_serializer.rb +2 -18
  26. data/lib/serialbench/serializers/xml/base_xml_serializer.rb +4 -16
  27. data/lib/serialbench/serializers/xml/leptris_serializer.rb +1 -5
  28. data/lib/serialbench/serializers/xml/libxml_serializer.rb +4 -9
  29. data/lib/serialbench/serializers/xml/nokogiri_serializer.rb +3 -3
  30. data/lib/serialbench/serializers/xml/oga_serializer.rb +3 -5
  31. data/lib/serialbench/serializers/xml/ox_serializer.rb +2 -2
  32. data/lib/serialbench/serializers/xml/rexml_serializer.rb +5 -12
  33. data/lib/serialbench/serializers/yaml/base_yaml_serializer.rb +1 -9
  34. data/lib/serialbench/serializers/yaml/syck_serializer.rb +0 -8
  35. data/lib/serialbench/test_data.rb +315 -0
  36. data/lib/serialbench/version.rb +1 -1
  37. data/lib/serialbench.rb +2 -1
  38. data/serialbench.gemspec +1 -2
  39. metadata +6 -23
  40. data/.github/workflows/windows-debug.yml +0 -171
  41. data/lib/serialbench/cli/resultset_cli.rb +0 -301
  42. data/lib/serialbench/models/result_set.rb +0 -79
  43. data/lib/serialbench/site_generator.rb +0 -337
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed5cf6538b0a64c26b9d9c0739b943f750f30476aa27a94c5b87aae98c203b55
4
- data.tar.gz: 3d1e7eb5c8f71c4052014729bd6dbbf4417a68339065a7a934ea1e5a3ef82a3b
3
+ metadata.gz: 7267d278bec24e38ca217bfbf164c10411f03b4fb333295f05c617c56f91a8b8
4
+ data.tar.gz: fcf4034a75ee9615197e2fd0cd3e7b63a795c7f3f0b1ba2c3b1cd0170babecb6
5
5
  SHA512:
6
- metadata.gz: 8bd0e7a6052712f3a49c4656e6aa663cd4db2215c9f9ebc3ac8379b7f258f78e488fdfc46bb52a8e6e9d89cc07ef78fa4fbebe6f0471881b679d40d5ab42284d
7
- data.tar.gz: 5441d7d92266df86976a78dd4fb68acf8c491147c799b06aa9e1a67ac5bd382dfd27547505e4566483a9657f983bc7bb0ffb5280cc17089de61a8b070fe5677b
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
@@ -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: [ master, main ]
5
+ branches: [ main ]
8
6
  tags: [ v* ]
9
- paths-ignore:
10
- - '.github/workflows/windows-debug.yml'
11
7
  pull_request:
12
- paths-ignore:
13
- - '.github/workflows/windows-debug.yml'
8
+
9
+ permissions:
10
+ contents: read
14
11
 
15
12
  jobs:
16
- rake:
17
- uses: metanorma/ci/.github/workflows/generic-rake.yml@main
18
- with:
19
- before-setup-ruby: |
20
- vcpkg install libxml2:x64-windows 2>&1 || true
21
- vcpkg integrate install 2>&1 || true
22
- mkdir -p .bundle 2>&1 || true
23
- echo "---" > .bundle/config 2>&1 || true
24
- echo 'BUNDLE_BUILD__LIBXML___RUBY: "--with-xml2-dir=C:/vcpkg/installed/x64-windows --with-xml2-include=C:/vcpkg/installed/x64-windows/include/libxml2 --with-xml2-lib=C:/vcpkg/installed/x64-windows/lib"' >> .bundle/config 2>&1 || true
25
- secrets:
26
- pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
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.0' # pin to latest git tag; newer gems expect APIs not in v1.9.0 source builds # Needs the libleptris shared library (LEPTRIS_LIB_PATH or system install)
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'
@@ -17,8 +17,8 @@ iterations:
17
17
  large: 1
18
18
 
19
19
  operations:
20
- - parse
21
- - generate
20
+ - parsing
21
+ - generation
22
22
  - streaming
23
23
  - memory
24
24
 
@@ -17,8 +17,8 @@ iterations:
17
17
  large: 1
18
18
 
19
19
  operations:
20
- - parse
21
- - generate
20
+ - parsing
21
+ - generation
22
22
  - streaming
23
23
  - memory
24
24
 
@@ -17,8 +17,8 @@ iterations:
17
17
  large: 1
18
18
 
19
19
  operations:
20
- - parse
21
- - generate
20
+ - parsing
21
+ - generation
22
22
  - streaming
23
23
  - xpath
24
24
  - memory
@@ -17,8 +17,8 @@ iterations:
17
17
  large: 1
18
18
 
19
19
  operations:
20
- - parse
21
- - generate
20
+ - parsing
21
+ - generation
22
22
  - streaming
23
23
  - memory
24
24
 
@@ -25,8 +25,8 @@ iterations:
25
25
  large: 1
26
26
 
27
27
  operations:
28
- - parse
29
- - generate
28
+ - parsing
29
+ - generation
30
30
  - streaming
31
31
  - xpath
32
32
  - memory
@@ -19,8 +19,8 @@ iterations:
19
19
  large: 1
20
20
 
21
21
  operations:
22
- - parse
23
- - generate
22
+ - parsing
23
+ - generation
24
24
  - streaming
25
25
 
26
26
  warmup: 2
@@ -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(&:supports_generation?)
151
+ serializers.select { |s| s.supports?(:generate) }
149
152
  when 'streaming'
150
- serializers.select(&:supports_streaming?)
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.send(size.to_s)
158
- end
159
-
160
- def load_test_data
161
- # Determine which data sizes to load based on configuration
162
- data_sizes = @benchmark_config.data_sizes
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 generate_test_data(format, size)
185
- method_name = "generate_#{size}_#{format}"
186
- send(method_name)
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
- def generate_large_yaml
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
- # TOML test data generators
381
- def generate_small_toml
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
- # def execute_local_benchmark(environment, config, benchmark_config_path)
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
- # Use the ASDF runner to execute the benchmark
430
- require_relative '../asdf_runner'
361
+ require_relative '../runners/asdf_runner'
431
362
 
432
- # Create a config object that AsdfRunner expects
433
- asdf_config = environment.merge({
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
- runner = Serialbench::AsdfRunner.new(asdf_config)
366
+ result_dir = "results/runs/#{environment.name}-results"
367
+ FileUtils.mkdir_p(result_dir)
438
368
 
439
- say "Installing Ruby #{environment['ruby_build_tag']} via ASDF...", :white
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: results/runs/#{environment['name']}", :cyan
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]
@@ -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[parse generate memory streaming]
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