https://github.com/nnmrts/vr-test
https://github.com/nnmrts/vr-test
Last synced: about 21 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/nnmrts/vr-test
- Owner: nnmrts
- Created: 2021-11-22T20:28:31.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-30T09:58:03.000Z (over 4 years ago)
- Last Synced: 2025-10-06T01:32:30.462Z (10 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# vr-test
This is a benchmark and test of a rewrite of vr's `loadConfig` function. Its purpose is to show the impact of allowing more file extensions for config files. The example config file used here is taken from [jurassiscripts/velociraptor/scripts.yml](https://github.com/jurassiscripts/velociraptor/blob/main/scripts.yml) and is converted to all currently supported and proposed formats under the [`configs`](./configs) folder.
## How it works
The [`test.js`](./test.js) module contains three main functions, `loadConfig`, `loadConfigNet` and `loadConfigNetNaive`, which all basically do the same things in the following order:
- Given a set of possible file names and file extensions, find out all possible combinations.
- For every single one of these combinations, do this:
- go into a folder called `.`.
- try to find the file `.` by looping through all possible combinations **in the same order**
- if found, read the text content of the file and return it
The module will show you the average time it took finding and reading these files for a specified number of times and a total average of these averages.
The `test-multiple.js` file can be used to easily display the averages of different file extension configurations. Calling:
```sh
deno run -A test-multiple.js --extensions=yaml,json,js
```
is basically the short form of calling
```sh
deno run -A test.js --extensions=yaml
deno run -A test.js --extensions=yaml,json
deno run -A test.js --extensions=yaml,json,js
```
and then displaying all these averages in a table similar to `test.js`.
## Usage
```sh
deno run -A test.js
```
```sh
deno run -A test-multiple.js
```
## Options
### `--times=`
Specifies the number of times the module should do the same thing. A higher number here obviously gives a better average. Default is `1`.
### `--net`
Specifies if the module should use `https://raw.githubusercontent.com/nnmrts/vr-test/main/configs` as working directory instead of the local [`configs`](./configs) folder. This also fundamentally changes how the module will request files, using `fetch` instead of file system functions for example.
### `--naive`
Specifies if the module should use naive, sequential fetching of online files. Does nothing if `--net` is not specified
### `--extensions=`
Specifies which file extensions are "allowed" and taken into consideration. The order matters a lot, since the local and naive online versions of this module work sequentially. Default is `yaml,yml,json,ts,js,mjs`.