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
|
@@ -8,7 +8,6 @@ module Serialbench
|
|
|
8
8
|
class ResultStore
|
|
9
9
|
DEFAULT_BASE_PATH = 'results'
|
|
10
10
|
RUNS_PATH = 'runs'
|
|
11
|
-
SETS_PATH = 'sets'
|
|
12
11
|
|
|
13
12
|
attr_reader :base_path
|
|
14
13
|
|
|
@@ -34,27 +33,6 @@ module Serialbench
|
|
|
34
33
|
limit ? runs.first(limit) : runs
|
|
35
34
|
end
|
|
36
35
|
|
|
37
|
-
# Run set management
|
|
38
|
-
def sets_path
|
|
39
|
-
File.join(@base_path, SETS_PATH)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def find_resultsets(tags: nil, limit: nil)
|
|
43
|
-
resultsets = ResultSet.find_all(sets_path)
|
|
44
|
-
|
|
45
|
-
resultsets = resultsets.select { |resultset| (Array(tags) - resultset.tags).empty? } if tags
|
|
46
|
-
|
|
47
|
-
limit ? resultsets.first(limit) : resultsets
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Convenience methods
|
|
51
|
-
def create_resultset(name, run_platform_strings, metadata: {})
|
|
52
|
-
run_paths = run_platform_strings.map { |ps| File.join(runs_path, ps) }
|
|
53
|
-
resultset = ResultSet.create(name, run_paths, metadata: metadata)
|
|
54
|
-
save_resultset(resultset)
|
|
55
|
-
resultset
|
|
56
|
-
end
|
|
57
|
-
|
|
58
36
|
# Validation
|
|
59
37
|
def validate_structure
|
|
60
38
|
errors = []
|
|
@@ -62,7 +40,6 @@ module Serialbench
|
|
|
62
40
|
# Check base structure
|
|
63
41
|
errors << "Base path does not exist: #{@base_path}" unless Dir.exist?(@base_path)
|
|
64
42
|
errors << "Runs directory does not exist: #{runs_path}" unless Dir.exist?(runs_path)
|
|
65
|
-
errors << "Sets directory does not exist: #{sets_path}" unless Dir.exist?(sets_path)
|
|
66
43
|
|
|
67
44
|
# Validate individual runs
|
|
68
45
|
if Dir.exist?(runs_path)
|
|
@@ -78,20 +55,6 @@ module Serialbench
|
|
|
78
55
|
end
|
|
79
56
|
end
|
|
80
57
|
|
|
81
|
-
# Validate result sets
|
|
82
|
-
if Dir.exist?(sets_path)
|
|
83
|
-
Dir.glob(File.join(sets_path, '*')).each do |set_path|
|
|
84
|
-
next unless Dir.exist?(set_path)
|
|
85
|
-
|
|
86
|
-
begin
|
|
87
|
-
resultset = ResultSet.load(set_path)
|
|
88
|
-
resultset.validate!
|
|
89
|
-
rescue StandardError => e
|
|
90
|
-
errors << "Invalid result set at #{set_path}: #{e.message}"
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
58
|
errors
|
|
96
59
|
end
|
|
97
60
|
|
|
@@ -101,7 +64,6 @@ module Serialbench
|
|
|
101
64
|
|
|
102
65
|
def ensure_results_directory
|
|
103
66
|
FileUtils.mkdir_p(runs_path) unless Dir.exist?(runs_path)
|
|
104
|
-
FileUtils.mkdir_p(sets_path) unless Dir.exist?(sets_path)
|
|
105
67
|
end
|
|
106
68
|
end
|
|
107
69
|
end
|
data/lib/serialbench/models.rb
CHANGED
|
@@ -6,7 +6,6 @@ require_relative 'models/result'
|
|
|
6
6
|
require_relative 'models/result_store'
|
|
7
7
|
require_relative 'models/benchmark_config'
|
|
8
8
|
require_relative 'models/environment_config'
|
|
9
|
-
require_relative 'models/result_set'
|
|
10
9
|
|
|
11
10
|
module Serialbench
|
|
12
11
|
module Models
|
|
@@ -46,9 +45,5 @@ module Serialbench
|
|
|
46
45
|
def self.create_run(platform_string, benchmark_data, metadata: {})
|
|
47
46
|
Result.create(platform_string, benchmark_data, metadata: metadata)
|
|
48
47
|
end
|
|
49
|
-
|
|
50
|
-
def self.create_resultset(name, run_paths_or_objects, metadata: {})
|
|
51
|
-
ResultSet.create(name, run_paths_or_objects, metadata: metadata)
|
|
52
|
-
end
|
|
53
48
|
end
|
|
54
49
|
end
|
|
@@ -19,32 +19,20 @@ module Serialbench
|
|
|
19
19
|
generate(object, options)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
def capabilities
|
|
23
|
+
super | Set.new(%i[pretty_print])
|
|
24
|
+
end
|
|
25
|
+
|
|
22
26
|
# JSON-specific features
|
|
23
27
|
def features
|
|
24
28
|
{
|
|
25
|
-
pretty_print:
|
|
26
|
-
streaming:
|
|
27
|
-
symbol_keys:
|
|
28
|
-
custom_types:
|
|
29
|
+
pretty_print: supports?(:pretty_print),
|
|
30
|
+
streaming: supports?(:sax) || supports?(:streaming),
|
|
31
|
+
symbol_keys: supports?(:symbol_keys),
|
|
32
|
+
custom_types: supports?(:custom_types)
|
|
29
33
|
}
|
|
30
34
|
end
|
|
31
35
|
|
|
32
|
-
def supports_generation?
|
|
33
|
-
true
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def supports_pretty_print?
|
|
37
|
-
true
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def supports_symbol_keys?
|
|
41
|
-
false
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def supports_custom_types?
|
|
45
|
-
false
|
|
46
|
-
end
|
|
47
|
-
|
|
48
36
|
# Subclasses should override this to specify their library name
|
|
49
37
|
def library_require_name
|
|
50
38
|
raise NotImplementedError, 'Subclasses must implement #library_require_name'
|
|
@@ -34,22 +34,6 @@ module Serialbench
|
|
|
34
34
|
JSON.generate(object)
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
|
-
|
|
38
|
-
def supports_streaming?
|
|
39
|
-
false
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def supports_pretty_print?
|
|
43
|
-
true
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def supports_symbol_keys?
|
|
47
|
-
false
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def supports_custom_types?
|
|
51
|
-
false
|
|
52
|
-
end
|
|
53
37
|
end
|
|
54
38
|
end
|
|
55
39
|
end
|
|
@@ -46,23 +46,8 @@ module Serialbench
|
|
|
46
46
|
super
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def
|
|
50
|
-
|
|
51
|
-
Oj.respond_to?(:saj_parse)
|
|
52
|
-
rescue LoadError
|
|
53
|
-
false
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def supports_pretty_print?
|
|
57
|
-
true
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def supports_symbol_keys?
|
|
61
|
-
true
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def supports_custom_types?
|
|
65
|
-
true
|
|
49
|
+
def capabilities
|
|
50
|
+
super | Set.new(%i[symbol_keys custom_types sax])
|
|
66
51
|
end
|
|
67
52
|
end
|
|
68
53
|
|
|
@@ -19,41 +19,20 @@ module Serialbench
|
|
|
19
19
|
generate(object, options)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
def capabilities
|
|
23
|
+
super | Set.new(%i[arrays_of_tables inline_tables multiline_strings])
|
|
24
|
+
end
|
|
25
|
+
|
|
22
26
|
# TOML-specific features
|
|
23
27
|
def features
|
|
24
28
|
{
|
|
25
|
-
comments:
|
|
26
|
-
arrays_of_tables:
|
|
27
|
-
inline_tables:
|
|
28
|
-
multiline_strings:
|
|
29
|
+
comments: supports?(:comments),
|
|
30
|
+
arrays_of_tables: supports?(:arrays_of_tables),
|
|
31
|
+
inline_tables: supports?(:inline_tables),
|
|
32
|
+
multiline_strings: supports?(:multiline_strings)
|
|
29
33
|
}
|
|
30
34
|
end
|
|
31
35
|
|
|
32
|
-
def supports_generation?
|
|
33
|
-
true
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def supports_streaming?
|
|
37
|
-
# TOML is typically not streamed due to its structure
|
|
38
|
-
false
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def supports_comments?
|
|
42
|
-
false
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def supports_arrays_of_tables?
|
|
46
|
-
true
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def supports_inline_tables?
|
|
50
|
-
true
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def supports_multiline_strings?
|
|
54
|
-
true
|
|
55
|
-
end
|
|
56
|
-
|
|
57
36
|
# Subclasses should override this to specify their library name
|
|
58
37
|
def library_require_name
|
|
59
38
|
raise NotImplementedError, 'Subclasses must implement #library_require_name'
|
|
@@ -31,22 +31,6 @@ module Serialbench
|
|
|
31
31
|
require 'toml-rb'
|
|
32
32
|
TomlRB.dump(object)
|
|
33
33
|
end
|
|
34
|
-
|
|
35
|
-
def supports_comments?
|
|
36
|
-
false
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def supports_arrays_of_tables?
|
|
40
|
-
true
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def supports_inline_tables?
|
|
44
|
-
true
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def supports_multiline_strings?
|
|
48
|
-
true
|
|
49
|
-
end
|
|
50
34
|
end
|
|
51
35
|
end
|
|
52
36
|
end
|
|
@@ -31,24 +31,8 @@ module Serialbench
|
|
|
31
31
|
raise NotImplementedError, 'tomlrb gem does not support TOML generation/dumping'
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def supports_comments?
|
|
39
|
-
false
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def supports_arrays_of_tables?
|
|
43
|
-
true
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def supports_inline_tables?
|
|
47
|
-
true
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def supports_multiline_strings?
|
|
51
|
-
true
|
|
34
|
+
def capabilities
|
|
35
|
+
Set.new(%i[dom parse arrays_of_tables inline_tables multiline_strings])
|
|
52
36
|
end
|
|
53
37
|
end
|
|
54
38
|
end
|
|
@@ -23,6 +23,10 @@ module Serialbench
|
|
|
23
23
|
generate(document, options)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
def capabilities
|
|
27
|
+
super | Set.new(%i[namespaces])
|
|
28
|
+
end
|
|
29
|
+
|
|
26
30
|
# XML-specific features derive from the capability set
|
|
27
31
|
def features
|
|
28
32
|
{
|
|
@@ -34,22 +38,6 @@ module Serialbench
|
|
|
34
38
|
}
|
|
35
39
|
end
|
|
36
40
|
|
|
37
|
-
def supports_generation?
|
|
38
|
-
true
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def supports_xpath?
|
|
42
|
-
false
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def supports_namespaces?
|
|
46
|
-
true
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def supports_validation?
|
|
50
|
-
false
|
|
51
|
-
end
|
|
52
|
-
|
|
53
41
|
# Check if the XML library is available
|
|
54
42
|
def available?
|
|
55
43
|
return @available if defined?(@available)
|
|
@@ -36,12 +36,8 @@ module Serialbench
|
|
|
36
36
|
handler.elements_processed
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def supports_streaming?
|
|
40
|
-
true
|
|
41
|
-
end
|
|
42
|
-
|
|
43
39
|
def capabilities
|
|
44
|
-
super | Set.new(%i[xpath
|
|
40
|
+
super | Set.new(%i[xpath sax stax])
|
|
45
41
|
end
|
|
46
42
|
|
|
47
43
|
def xpath_query(document, expression)
|
|
@@ -38,17 +38,12 @@ module Serialbench
|
|
|
38
38
|
handler.elements_processed
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def
|
|
42
|
-
|
|
41
|
+
def capabilities
|
|
42
|
+
super | Set.new(%i[xpath stax sax])
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
true
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def supports_streaming?
|
|
51
|
-
true
|
|
45
|
+
def xpath_query(document, expression)
|
|
46
|
+
document.find(expression).size
|
|
52
47
|
end
|
|
53
48
|
|
|
54
49
|
def version
|
|
@@ -39,11 +39,11 @@ module Serialbench
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def capabilities
|
|
42
|
-
super | Set.new(%i[xpath
|
|
42
|
+
super | Set.new(%i[xpath sax stax])
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def
|
|
46
|
-
|
|
45
|
+
def xpath_query(document, expression)
|
|
46
|
+
document.xpath(expression).size
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def version
|
|
@@ -38,17 +38,15 @@ module Serialbench
|
|
|
38
38
|
handler.elements_processed
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def
|
|
42
|
-
|
|
41
|
+
def capabilities
|
|
42
|
+
super | Set.new(%i[xpath sax])
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def xpath_query(document, expression)
|
|
46
46
|
document.xpath(expression).size
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
true
|
|
51
|
-
end
|
|
49
|
+
|
|
52
50
|
|
|
53
51
|
def version
|
|
54
52
|
return 'unknown' unless available?
|
|
@@ -73,20 +73,13 @@ module Serialbench
|
|
|
73
73
|
handler.result
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
def
|
|
77
|
-
|
|
76
|
+
def capabilities
|
|
77
|
+
super | Set.new(%i[xpath])
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
def
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def supports_namespaces?
|
|
85
|
-
true
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def supports_validation?
|
|
89
|
-
false
|
|
80
|
+
def xpath_query(document, expression)
|
|
81
|
+
require 'rexml/xpath'
|
|
82
|
+
REXML::XPath.match(document, expression).size
|
|
90
83
|
end
|
|
91
84
|
|
|
92
85
|
private
|
|
@@ -11,12 +11,8 @@ module Serialbench
|
|
|
11
11
|
:yaml
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def supports_streaming?
|
|
15
|
-
false # Most YAML parsers don't support streaming
|
|
16
|
-
end
|
|
17
|
-
|
|
18
14
|
def features
|
|
19
|
-
{ streaming:
|
|
15
|
+
{ streaming: supports?(:sax) || supports?(:streaming) }
|
|
20
16
|
end
|
|
21
17
|
|
|
22
18
|
# Default YAML generation options
|
|
@@ -39,10 +35,6 @@ module Serialbench
|
|
|
39
35
|
raise NotImplementedError, 'Streaming not supported by this YAML serializer'
|
|
40
36
|
end
|
|
41
37
|
|
|
42
|
-
def supports_generation?
|
|
43
|
-
true
|
|
44
|
-
end
|
|
45
|
-
|
|
46
38
|
private
|
|
47
39
|
|
|
48
40
|
def require_library(library_name)
|