Skip to content

Commit 9f7bded

Browse files
committed
Merge branch 'release/6.2.0'
2 parents 889969f + e5b3b44 commit 9f7bded

File tree

18 files changed

+217
-199
lines changed

18 files changed

+217
-199
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/" # Location of package manifests
5+
schedule:
6+
interval: "daily"

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
os: [ubuntu-latest, macos-latest, windows-latest]
12-
node-version: [10.x, 11.x, 12.x, 13.x, 14.x, 15.x]
12+
node-version: [10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x, 17.x, 18.x]
1313
runs-on: ${{matrix.os}}
1414
steps:
1515
- uses: actions/checkout@v2
@@ -20,4 +20,4 @@ jobs:
2020
- name: Install Dependencies
2121
run: npm install
2222
- name: Test
23-
run: npm test
23+
run: npm test

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
> camaro is an utility to transform XML to JSON, using Node.js binding to native XML parser [pugixml](http://pugixml.org/), one of the fastest XML parser around.
44
5-
[![npm](https://webadge.dev/npm/v/camaro)](https://npm.im/camaro)
6-
![npm bundle size](https://webadge.dev/packagephobia/publish/camaro)
5+
[![npm](https://raster.shields.io/npm/v/camaro)](https://npm.im/camaro)
76
![Build status](https://github.com/tuananh/camaro/workflows/CI/badge.svg)
8-
[![TypeScript definitions on DefinitelyTyped](https://webadge.dev/badge/DefinitelyTyped/.d.ts)](http://definitelytyped.org)
9-
[![npm](https://webadge.dev/npm/dt/camaro)](https://npm.im/camaro)
7+
[![npm](https://raster.shields.io/npm/dt/camaro)](https://npm.im/camaro)
8+
[![license](https://raster.shields.io/npm/l/camaro)](https://npm.im/camaro)
109

1110
## 🤘 Features
1211

@@ -185,6 +184,10 @@ And output of `prettyPrint()`
185184

186185
...
187186

187+
## Stargazers over time
188+
189+
[![Stargazers over time](https://starchart.cc/tuananh/camaro.svg)](https://starchart.cc/tuananh/camaro)
190+
188191
## Licence
189192

190193
[The MIT License](LICENSE)
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,17 @@
22

33
Never mind about the actual number. You can check the percentage differences between package for reference.
44

5-
Benchmark ran on Macbook 16".
6-
75
## transform()
86

97
`node benchmark/transform`
108

11-
```
12-
camaro v6: 1,395.6 ops/sec
13-
fast-xml-parser: 153 ops/sec
14-
xml2js: 47.6 ops/sec
15-
xml-js: 51 ops/sec
16-
```
9+
Benchmark scenario:
10+
- 10,000 iterations
11+
- 4 different input size: 7KB/ 60KB / 100KB and 300KB. Test inputs are included in `fixtures` folder.
12+
- Output is average no. of ops per second.
13+
- Machine specs: AMD 4650G 6 cores - 12 threads/ 32GB memory
1714

18-
I have included the test for various XML file sizes: 300KB/ 100KB / 60KB and 7KB. As you can see `camaro` is not very good with small XML file. However, it excels with big XML file.
19-
20-
The tested XML files are included in `benchmarks/fixtures` folder.
15+
As you can see `camaro` is not very good with small XML file. However, it excels with big XML file.
2116

2217
300 KB XML file | 100 KB XML file
2318
:-------------------------:|:-------------------------:
@@ -37,4 +32,4 @@ The tested XML files are included in `benchmarks/fixtures` folder.
3732
camaro v6: 62,363.2 ops/sec
3833
pretty-data: 141,257.8 ops/sec
3934
prettifyXml: 258,408 ops/sec
40-
```
35+
```

benchmark/chart.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@
1313
data: {
1414
labels: [
1515
'camaro v6',
16+
'txml w/ piscina',
17+
'fast-xml-parser w/ piscina',
1618
'fast-xml-parser',
1719
'xml2js',
1820
'xml-js',
1921
],
2022
datasets: [
2123
{
2224
label: 'ops/sec',
23-
// data: [1820, 295, 52, 52], // 306kb
24-
data: [3539, 864, 148, 144], // 109kb
25-
// data: [4840, 1542, 266, 265], // 60kb
26-
// data: [6215, 9328, 2108, 2099], // 7kb
25+
data: [1780, 1356, 565, 129, 50, 55], // 306kb
26+
// data: [4237, 3320, 1586, 392, 137, 142], // 109kb
27+
// data: [6112, 5757, 2637, 766, 260, 282], // 60kb
28+
// data: [13193, 17422, 11148, 6720, 1955, 1990], // 7kb
2729
backgroundColor: [
2830
'rgba(255, 99, 132, 0.2)',
2931
'rgba(54, 162, 235, 0.2)',

benchmark/fixtures/100kb.png

22.8 KB
Loading

benchmark/fixtures/300kb.png

19.3 KB
Loading

benchmark/fixtures/60kb.png

20 KB
Loading

benchmark/fixtures/7kb.png

15.8 KB
Loading

benchmark/transform.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
const fs = require('fs')
2+
const { resolve } = require('path')
23
const { transform } = require('..')
3-
const fastXmlParser = require('fast-xml-parser')
4+
const { XMLParser } = require('fast-xml-parser')
45
const xml2js = require('xml2js')
56
const xmljs = require('xml-js')
7+
const WorkerPool = require('piscina')
8+
const fastXmlParser = new XMLParser()
9+
10+
const txmlWorkerPool = new WorkerPool({ filename: resolve(__dirname, 'workers/txml.js') });
11+
const fxpWorkerPool = new WorkerPool({ filename: resolve(__dirname, 'workers/fast-xml-parser.js') });
612

713
/**
814
*
@@ -36,7 +42,7 @@ async function bench({ name = '', fn, iterations = 10000, async = false } = {})
3642
}
3743
}
3844

39-
const xml = fs.readFileSync(__dirname + '/./fixtures/100kb.xml', 'utf-8')
45+
const xml = fs.readFileSync(__dirname + '/./fixtures/300kb.xml', 'utf-8')
4046
const template = {
4147
cache_key: '/HotelListResponse/cacheKey',
4248
hotels: [
@@ -67,10 +73,14 @@ const template = {
6773
async function runBenchmarks() {
6874
await bench({
6975
name: 'camaro v6',
70-
fn: () => transform(xml, template),
76+
fn: async () => transform(xml, template),
7177
async: true,
7278
})
7379

80+
await bench({name: 'txml worker', async: true, fn: async () => txmlWorkerPool.run(xml) });
81+
82+
await bench({name: 'fast-xml-parser worker', async: true, fn: async () => fxpWorkerPool.run(xml)});
83+
7484
await bench({name: 'fast-xml-parser', fn: () => fastXmlParser.parse(xml)})
7585

7686
await bench({name: 'xml2js', fn: () => xml2js.parseString(xml) })

0 commit comments

Comments
 (0)