serialbench 0.1.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 +7 -0
- data/.github/workflows/benchmark.yml +125 -0
- data/.github/workflows/ci.yml +74 -0
- data/.rspec +4 -0
- data/Gemfile +34 -0
- data/README.adoc +592 -0
- data/Rakefile +63 -0
- data/exe/serialbench +6 -0
- data/lib/serialbench/benchmark_runner.rb +540 -0
- data/lib/serialbench/chart_generator.rb +821 -0
- data/lib/serialbench/cli.rb +438 -0
- data/lib/serialbench/memory_profiler.rb +31 -0
- data/lib/serialbench/result_formatter.rb +182 -0
- data/lib/serialbench/result_merger.rb +1201 -0
- data/lib/serialbench/serializers/base_serializer.rb +63 -0
- data/lib/serialbench/serializers/json/base_json_serializer.rb +67 -0
- data/lib/serialbench/serializers/json/json_serializer.rb +58 -0
- data/lib/serialbench/serializers/json/oj_serializer.rb +102 -0
- data/lib/serialbench/serializers/json/yajl_serializer.rb +67 -0
- data/lib/serialbench/serializers/toml/base_toml_serializer.rb +76 -0
- data/lib/serialbench/serializers/toml/toml_rb_serializer.rb +55 -0
- data/lib/serialbench/serializers/toml/tomlib_serializer.rb +50 -0
- data/lib/serialbench/serializers/xml/base_parser.rb +69 -0
- data/lib/serialbench/serializers/xml/base_xml_serializer.rb +71 -0
- data/lib/serialbench/serializers/xml/libxml_parser.rb +98 -0
- data/lib/serialbench/serializers/xml/libxml_serializer.rb +127 -0
- data/lib/serialbench/serializers/xml/nokogiri_parser.rb +111 -0
- data/lib/serialbench/serializers/xml/nokogiri_serializer.rb +118 -0
- data/lib/serialbench/serializers/xml/oga_parser.rb +85 -0
- data/lib/serialbench/serializers/xml/oga_serializer.rb +125 -0
- data/lib/serialbench/serializers/xml/ox_parser.rb +64 -0
- data/lib/serialbench/serializers/xml/ox_serializer.rb +88 -0
- data/lib/serialbench/serializers/xml/rexml_parser.rb +129 -0
- data/lib/serialbench/serializers/xml/rexml_serializer.rb +121 -0
- data/lib/serialbench/serializers.rb +62 -0
- data/lib/serialbench/version.rb +5 -0
- data/lib/serialbench.rb +42 -0
- data/serialbench.gemspec +51 -0
- metadata +239 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b9ac1e7ab2d7d19b78eae4a6de4b13e8d82a0b3ac266b1ed96611d6b33be7dad
|
4
|
+
data.tar.gz: deb679e04bbbe7eadc863d32b35e1ee27b02563d8591b2999b56689ba39dcd62
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9c666c6d7be0f8f4dc56da8f68e994dc23179900104f3fdaf50d02d70eb86287c528fc46a192fa021278a8a6726551b11b7eac9b74d0d33cdd6e65241cb39767
|
7
|
+
data.tar.gz: 6be2ada3d82811a1c5d5ffd4c415ce19c84fdb60765c61cdde76a367eb5ffa1b895d89306a71d7696156930c6c06de561f8036b4deb58efcd45fa82b83d4978e
|
@@ -0,0 +1,125 @@
|
|
1
|
+
name: SerialBench XML Benchmarks
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main, master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main, master ]
|
8
|
+
schedule:
|
9
|
+
# Run benchmarks weekly on Sundays at 2 AM UTC
|
10
|
+
- cron: '0 2 * * 0'
|
11
|
+
workflow_dispatch:
|
12
|
+
# Allow manual triggering
|
13
|
+
|
14
|
+
permissions:
|
15
|
+
contents: read
|
16
|
+
pages: write
|
17
|
+
id-token: write
|
18
|
+
|
19
|
+
concurrency:
|
20
|
+
group: "pages"
|
21
|
+
cancel-in-progress: false
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
setup:
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
outputs:
|
27
|
+
ruby-versions: ${{ steps.set-matrix.outputs.ruby-versions }}
|
28
|
+
ruby-versions-list: ${{ steps.set-matrix.outputs.ruby-versions-list }}
|
29
|
+
steps:
|
30
|
+
- name: Set Ruby version matrix
|
31
|
+
id: set-matrix
|
32
|
+
run: |
|
33
|
+
echo 'ruby-versions=["3.1", "3.2", "3.3", "3.4"]' >> $GITHUB_OUTPUT
|
34
|
+
echo 'ruby-versions-list=3.1 3.2 3.3 3.4' >> $GITHUB_OUTPUT
|
35
|
+
|
36
|
+
benchmark:
|
37
|
+
runs-on: ubuntu-latest
|
38
|
+
needs: setup
|
39
|
+
strategy:
|
40
|
+
matrix:
|
41
|
+
ruby-version: ${{ fromJson(needs.setup.outputs.ruby-versions) }}
|
42
|
+
fail-fast: false
|
43
|
+
|
44
|
+
steps:
|
45
|
+
- uses: actions/checkout@v4
|
46
|
+
|
47
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
48
|
+
uses: ruby/setup-ruby@v1
|
49
|
+
with:
|
50
|
+
ruby-version: ${{ matrix.ruby-version }}
|
51
|
+
bundler-cache: true
|
52
|
+
|
53
|
+
- name: Install system dependencies
|
54
|
+
run: |
|
55
|
+
sudo apt-get update
|
56
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev
|
57
|
+
|
58
|
+
- name: List available serializers
|
59
|
+
run: |
|
60
|
+
bundle exec ruby exe/serialbench list
|
61
|
+
|
62
|
+
- name: Run tests
|
63
|
+
run: bundle exec rspec
|
64
|
+
|
65
|
+
- name: Run XML benchmarks
|
66
|
+
run: |
|
67
|
+
mkdir -p results-ruby-${{ matrix.ruby-version }}
|
68
|
+
bundle exec ruby exe/serialbench benchmark --formats xml
|
69
|
+
# Copy results to versioned directory
|
70
|
+
cp -r results/* results-ruby-${{ matrix.ruby-version }}/
|
71
|
+
|
72
|
+
- name: Upload benchmark results as artifact
|
73
|
+
uses: actions/upload-artifact@v4
|
74
|
+
with:
|
75
|
+
name: benchmark-results-ruby-${{ matrix.ruby-version }}
|
76
|
+
path: results-ruby-${{ matrix.ruby-version }}/
|
77
|
+
retention-days: 30
|
78
|
+
|
79
|
+
merge-and-deploy:
|
80
|
+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
81
|
+
runs-on: ubuntu-latest
|
82
|
+
needs: [setup, benchmark]
|
83
|
+
|
84
|
+
steps:
|
85
|
+
- uses: actions/checkout@v4
|
86
|
+
|
87
|
+
- name: Set up Ruby (for report generation)
|
88
|
+
uses: ruby/setup-ruby@v1
|
89
|
+
with:
|
90
|
+
ruby-version: '3.3'
|
91
|
+
bundler-cache: true
|
92
|
+
|
93
|
+
- name: Install system dependencies
|
94
|
+
run: |
|
95
|
+
sudo apt-get update
|
96
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev
|
97
|
+
|
98
|
+
- name: Download all benchmark artifacts
|
99
|
+
uses: actions/download-artifact@v4
|
100
|
+
with:
|
101
|
+
pattern: benchmark-results-ruby-*
|
102
|
+
path: artifacts/
|
103
|
+
|
104
|
+
- name: Generate GitHub Pages
|
105
|
+
run: |
|
106
|
+
mkdir -p docs
|
107
|
+
# Generate GitHub Pages from all Ruby version results dynamically
|
108
|
+
RUBY_VERSIONS="${{ needs.setup.outputs.ruby-versions-list }}"
|
109
|
+
ARTIFACT_PATHS=""
|
110
|
+
for version in $RUBY_VERSIONS; do
|
111
|
+
ARTIFACT_PATHS="$ARTIFACT_PATHS artifacts/benchmark-results-ruby-$version/"
|
112
|
+
done
|
113
|
+
bundle exec ruby exe/serialbench github_pages $ARTIFACT_PATHS docs/
|
114
|
+
|
115
|
+
- name: Setup Pages
|
116
|
+
uses: actions/configure-pages@v4
|
117
|
+
|
118
|
+
- name: Upload to GitHub Pages
|
119
|
+
uses: actions/upload-pages-artifact@v3
|
120
|
+
with:
|
121
|
+
path: docs
|
122
|
+
|
123
|
+
- name: Deploy to GitHub Pages
|
124
|
+
id: deployment
|
125
|
+
uses: actions/deploy-pages@v4
|
@@ -0,0 +1,74 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main, master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main, master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
setup:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
outputs:
|
13
|
+
ruby-versions: ${{ steps.set-matrix.outputs.ruby-versions }}
|
14
|
+
steps:
|
15
|
+
- name: Set Ruby version matrix
|
16
|
+
id: set-matrix
|
17
|
+
run: |
|
18
|
+
echo 'ruby-versions=["3.1", "3.2", "3.3", "3.4"]' >> $GITHUB_OUTPUT
|
19
|
+
|
20
|
+
test:
|
21
|
+
runs-on: ubuntu-latest
|
22
|
+
needs: setup
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ${{ fromJson(needs.setup.outputs.ruby-versions) }}
|
26
|
+
fail-fast: false
|
27
|
+
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v4
|
30
|
+
|
31
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
32
|
+
uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby-version }}
|
35
|
+
bundler-cache: true
|
36
|
+
|
37
|
+
- name: Install system dependencies
|
38
|
+
run: |
|
39
|
+
sudo apt-get update
|
40
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev
|
41
|
+
|
42
|
+
- name: List available serializers
|
43
|
+
run: bundle exec ruby exe/serialbench list
|
44
|
+
|
45
|
+
- name: Run tests
|
46
|
+
run: bundle exec rspec
|
47
|
+
|
48
|
+
- name: Run quick benchmark test
|
49
|
+
run: |
|
50
|
+
# Run a quick benchmark to ensure the CLI works
|
51
|
+
bundle exec ruby exe/serialbench benchmark --formats xml --data-sizes small --iterations 5
|
52
|
+
|
53
|
+
lint:
|
54
|
+
runs-on: ubuntu-latest
|
55
|
+
steps:
|
56
|
+
- uses: actions/checkout@v4
|
57
|
+
|
58
|
+
- name: Set up Ruby
|
59
|
+
uses: ruby/setup-ruby@v1
|
60
|
+
with:
|
61
|
+
ruby-version: '3.3'
|
62
|
+
bundler-cache: true
|
63
|
+
|
64
|
+
- name: Run RuboCop (if available)
|
65
|
+
run: |
|
66
|
+
if bundle list | grep -q rubocop; then
|
67
|
+
bundle exec rubocop
|
68
|
+
else
|
69
|
+
echo "RuboCop not found, skipping linting"
|
70
|
+
fi
|
71
|
+
continue-on-error: true
|
72
|
+
|
73
|
+
- name: Check gemspec
|
74
|
+
run: gem build serialbench.gemspec
|
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development, :test do
|
6
|
+
gem 'rake', '~> 13.0'
|
7
|
+
gem 'rspec', '~> 3.12'
|
8
|
+
gem 'rubocop', '~> 1.0'
|
9
|
+
end
|
10
|
+
|
11
|
+
group :benchmarking do
|
12
|
+
gem 'csv', '~> 3.2' # Required from Ruby 3.4+
|
13
|
+
|
14
|
+
# XML libraries
|
15
|
+
gem 'libxml-ruby', '~> 4.0'
|
16
|
+
gem 'nokogiri', '~> 1.15'
|
17
|
+
gem 'oga', '~> 3.4'
|
18
|
+
gem 'ox', '~> 2.14'
|
19
|
+
gem 'rexml', '~> 3.2' # Required from Ruby 3.4+
|
20
|
+
|
21
|
+
# JSON libraries
|
22
|
+
gem 'json', '~> 2.6' # Built-in but explicit version
|
23
|
+
gem 'oj', '~> 3.16'
|
24
|
+
gem 'yajl-ruby', '~> 1.4'
|
25
|
+
|
26
|
+
# TOML libraries
|
27
|
+
gem 'tomlib', '~> 0.6'
|
28
|
+
gem 'toml-rb', '~> 2.2'
|
29
|
+
|
30
|
+
# Benchmarking and reporting tools
|
31
|
+
gem 'asciidoctor', '~> 2.0'
|
32
|
+
gem 'benchmark-ips', '~> 2.12'
|
33
|
+
gem 'memory_profiler', '~> 1.0'
|
34
|
+
end
|