@balena/odata-parser
Advanced tools
Comparing version 3.0.2 to 3.0.3-build-fisehara-decode-uri-before-parsing-b08feb7761d3edc066716882242ed46880a5b6f8-1
@@ -7,4 +7,9 @@ # Change Log | ||
# v3.0.3 | ||
## (2024-01-04) | ||
* Decode escaped URI [fisehara] | ||
# v3.0.2 | ||
## (2024-01-03) | ||
## (2024-01-04) | ||
@@ -11,0 +16,0 @@ * Update dependencies [fisehara] |
{ | ||
"name": "@balena/odata-parser", | ||
"version": "3.0.2", | ||
"version": "3.0.3-build-fisehara-decode-uri-before-parsing-b08feb7761d3edc066716882242ed46880a5b6f8-1", | ||
"description": "An OData parser written in OMeta", | ||
@@ -42,4 +42,4 @@ "main": "odata-parser.js", | ||
"versionist": { | ||
"publishedAt": "2024-01-03T15:23:42.361Z" | ||
"publishedAt": "2024-01-04T10:25:30.286Z" | ||
} | ||
} |
import test from './test'; | ||
import * as assert from 'assert'; | ||
import * as _ from 'lodash'; | ||
import * as ODataParser from '../odata-parser'; | ||
function measureExecutionTime(runs, uri) { | ||
const startTime = Date.now(); | ||
for (let i = 0; i < runs; i++) { | ||
ODataParser.parse(uri); | ||
} | ||
const endTime = Date.now(); | ||
const diff = endTime - startTime; | ||
const perRun = diff / runs; | ||
console.log( | ||
`\turi.length: ${uri.length}\truns: ${runs}\tperRun: ${JSON.stringify( | ||
perRun, | ||
null, | ||
2, | ||
)}`, | ||
); | ||
return perRun; | ||
} | ||
const selects = []; | ||
for ( | ||
let randomSelectCounter = 0; | ||
randomSelectCounter < 100; | ||
randomSelectCounter++ | ||
) { | ||
selects.push(`long_field_name__field_${randomSelectCounter}`); | ||
} | ||
const $select = '$select=' + selects.join(','); | ||
const $filter = `$filter=(long_field_name__field%20eq%20%27value%27)%20and%20(long_field_name__field_1%20eq%20true)`; | ||
const $nestedExpand = `$expand=resource_test(${$select})`; | ||
const $expand = `$expand=resource_test(${$select};${$nestedExpand};${$filter})`; | ||
const randomURI = `/resource?${$select}&${$filter}&${$expand}`; | ||
const runCount = 1000; | ||
describe('Stress Testing', function () { | ||
@@ -13,2 +48,13 @@ const ids = _.range(1, 2000); | ||
}); | ||
it(`should parse long (${randomURI.length} chars) URI ${runCount} times and record average execution time`, () => { | ||
const perRun = measureExecutionTime(runCount, randomURI); | ||
assert.equal(perRun < 1.5, true); | ||
}); | ||
const shortRandomURI = `/resource(123456789)`; | ||
it(`should parse short (${shortRandomURI.length} chars) URI ${runCount} times and record average execution time`, () => { | ||
const perRun = measureExecutionTime(runCount, shortRandomURI); | ||
assert.equal(perRun < 0.1, true); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
246748
6466
2