Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1# picoquery2 3[](https://github.com/43081j/picoquery/actions/workflows/main.yml)4[](https://www.npmjs.com/package/picoquery)5 6A lightweight query string parser/stringifier with support for nesting and some7configurability.8 9Built on top of [fast-querystring](https://github.com/anonrig/fast-querystring).10 11## Install12 13```sh14npm i -S picoquery15```16 17### CommonJS vs ESM18 19`2.x` and above are _ESM only_ (i.e. your project will need `type: "module"`20in the `package.json`).21 22If you cannot yet move to ESM, you may continue to use `1.x` which will still23receive non-breaking changes, backported from `main`.24 25## Usage26 27Parsing a query string:28 29```ts30import {parse} from 'picoquery';31 32parse('foo.bar=abc&baz=def');33 34/*35 {36 foo: {37 bar: 'abc'38 },39 baz: 'def'40 }41*/42```43 44Stringifying an object:45 46```ts47import {stringify} from 'picoquery';48 49stringify({50 foo: {51 bar: 12352 }53});54 55/*56foo.bar=12357*/58```59 60## API61 62### `stringify(object[, options])`63 64Converts the given object into a query string, optionally with configured65options.66 67### `parse(str[, options])`68 69Parses the given query string into an object, optionally with configured70options.71 72## Options73 74### Default options75 76The default options are as follows:77 78```ts79{80 nesting: true,81 nestingSyntax: 'dot',82 arrayRepeat: false,83 arrayRepeatSyntax: 'repeat',84 delimiter: '&'85}86```87 88### `nesting`89 90When true, nested objects are supported.91 92For example, when parsing:93 94```ts95parse('foo.bar=baz', {nesting: true});96 97// {foo: {bar: 'baz'}}98```99 100When stringifying:101 102```ts103stringify({foo: {bar: 'baz'}}, {nesting: true});104 105// foo.bar=baz106```107 108This also results in arrays being supported:109 110```ts111parse('foo.0=bar', {nesting: true});112// {foo: ['bar']}113 114stringify({foo: ['bar']}, {nesting: true});115// foo.0=bar116```117 118### `nestingSyntax`119 120Sets which style of nesting syntax should be used. The choices are:121 122- `dot` (e.g. `foo.bar=baz`)123- `index` (e.g. `foo[bar]=baz`)124- `js` (e.g. `foo.bar[0]=baz`, i.e. arrays are indexed and properties are125dotted or indexed)126 127### `arrayRepeat`128 129If `true`, this will treat repeated keys as arrays.130 131For example:132 133```ts134parse('foo=x&foo=y', {arrayRepeat: true});135// {foo: ['x', 'y']}136 137stringify({foo: ['x', 'y']}, {arrayRepeat: true});138// foo=x&foo=y139```140 141### `arrayRepeatSyntax`142 143Sets which style of array repetition syntax should be used. The choices are:144 145- `bracket` (e.g. `foo[]=x&foo[]=y`)146- `repeat` (e.g. `foo=x&foo=y`)147 148### `delimiter`149 150Sets the delimiter to be used instead of `&`.151 152For example:153 154```ts155parse('foo=x;bar=y', {delimiter: ';'});156// {foo: 'x', bar: 'y'}157 158stringify({foo: 'x', bar: 'y'}, {delimiter: ';'});159// foo=x;bar=y160```161 162### `valueDeserializer`163 164Can be set to a function which will be used to deserialize each value during165parsing.166 167It will be called with the `value` and the already deserialized168`key` (i.e. `(value: string, key: PropertyKey) => *`).169 170For example:171 172```ts173parse('foo=300', {174 valueDeserializer: (value) => {175 const asNum = Number(value);176 return Number.isNaN(asNum) ? value : asNum;177 }178});179 180// {foo: 300}181```182 183### `keyDeserializer`184 185Can be set to a function which will be used to deserialize each key during186parsing.187 188It will be called with the `key` from the query string189(i.e. `(key) => PropertyKey`).190 191For example:192 193```ts194parse('300=foo', {195 keyDeserializer: (key) => {196 const asNum = Number(key);197 return Number.isNaN(asNum) ? key : asNum;198 }199});200 201// {300: 'foo'}202```203 204### `shouldSerializeObject`205 206Can be set to a function which determines if an _object-like_ value should be207serialized instead of being treated as a nested object.208 209**All non-object primitives will always be serialized.**210 211For example:212 213```214// Assuming `StringifableObject` returns its constructor value when `toString`215// is called.216stringify({217 foo: new StringifiableObject('test')218}, {219 shouldSerializeObject(val) {220 return val instanceof StringifableObject;221 },222 valueSerializer: (value) => {223 return String(value);224 }225});226 227// foo=test228```229 230If you want to fall back to the default logic, you can import the default231function:232 233```234import {defaultShouldSerializeObject, stringify} from 'picoquery';235 236stringify({237 foo: new StringifiableObject('test')238}, {239 shouldSerializeObject(val) {240 if (val instanceof StringifableObject) {241 return true;242 }243 return defaultShouldSerializeObject(val);244 }245});246```247 248### `valueSerializer`249 250Can be set to a function which will be used to serialize each value during251stringifying.252 253It will be called with the `value` and the `key`254(i.e. `(value: unknown, key: PropertyKey) => string`).255 256For example:257 258```ts259stringify({foo: 'bar'}, {260 valueSerializer: (val) => String(val) + String(val)261});262 263// foo=barbar264```265 266**Note** that you can import the default serializer if you only want to handle267some cases.268 269For example:270 271```ts272import {defaultValueSerializer, stringify} from 'picoquery';273 274stringify({foo: 'bar'}, {275 valueSerializer: (val, key) => {276 if (val instanceof Date) {277 return val.toISOString();278 }279 280 // Call the original serializer otherwise281 return defaultValueSerializer(val, key);282 }283});284```285 286## Benchmarks287 288**IMPORTANT**: there are a few things to take into account with these289benchmarks:290 291- `fast-querystring` is not capable of parsing or stringifying nested objects,292so the results are incomparible (but here as reference)293- all libraries have their own level of configurability. It will be possible294to increase perf in each of them by disabling various features, but these are295just the 'happy path'296 297### Parse298 299```300Benchmark: Basic (no nesting)301┌─────────┬─────────────────────────────────┬─────────────┬────────────────────┬──────────┬─────────┐302│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │303├─────────┼─────────────────────────────────┼─────────────┼────────────────────┼──────────┼─────────┤304│ 0 │ 'picoquery' │ '2,393,539' │ 417.79130492907393 │ '±0.42%' │ 1196770 │305│ 1 │ 'qs' │ '382,933' │ 2611.4212945313157 │ '±1.04%' │ 191467 │306│ 2 │ 'fast-querystring (no nesting)' │ '2,633,148' │ 379.77342802356833 │ '±1.58%' │ 1316575 │307└─────────┴─────────────────────────────────┴─────────────┴────────────────────┴──────────┴─────────┘308Benchmark: Dot-syntax nesting309┌─────────┬─────────────────────────────────┬─────────────┬───────────────────┬──────────┬─────────┐310│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │311├─────────┼─────────────────────────────────┼─────────────┼───────────────────┼──────────┼─────────┤312│ 0 │ 'picoquery' │ '1,406,039' │ 711.2176054736389 │ '±0.56%' │ 703020 │313│ 1 │ 'qs' │ '205,611' │ 4863.536155478235 │ '±0.98%' │ 102806 │314│ 2 │ 'fast-querystring (no nesting)' │ '2,588,560' │ 386.3151031345139 │ '±0.66%' │ 1294281 │315└─────────┴─────────────────────────────────┴─────────────┴───────────────────┴──────────┴─────────┘316```317 318### Stringify319 320```321Benchmark: Basic (no nesting)322┌─────────┬─────────────────────────────────┬─────────────┬────────────────────┬──────────┬─────────┐323│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │324├─────────┼─────────────────────────────────┼─────────────┼────────────────────┼──────────┼─────────┤325│ 0 │ 'picoquery' │ '4,163,092' │ 240.20605684139227 │ '±0.16%' │ 2081547 │326│ 1 │ 'qs' │ '843,630' │ 1185.352608720127 │ '±0.76%' │ 421816 │327│ 2 │ 'fast-querystring (no nesting)' │ '3,795,565' │ 263.46536774751036 │ '±0.24%' │ 1897783 │328└─────────┴─────────────────────────────────┴─────────────┴────────────────────┴──────────┴─────────┘329Benchmark: Dot-syntax nesting330┌─────────┬─────────────────────────────────┬─────────────┬────────────────────┬──────────┬─────────┐331│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │332├─────────┼─────────────────────────────────┼─────────────┼────────────────────┼──────────┼─────────┤333│ 0 │ 'picoquery' │ '1,768,770' │ 565.3644818387182 │ '±1.08%' │ 884387 │334│ 1 │ 'qs' │ '332,254' │ 3009.743667534287 │ '±1.38%' │ 166128 │335│ 2 │ 'fast-querystring (no nesting)' │ '7,227,031' │ 138.36940410118828 │ '±1.15%' │ 3613517 │336└─────────┴─────────────────────────────────┴─────────────┴────────────────────┴──────────┴─────────┘337```338 339## License340 341MIT342 