diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e6b913..b63cc4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/). } ``` 3. Add option for users to choose newline in JSON Lines. - +4. Add new arguments to `stringify` RemesPath function to allow pretty-printing or customization of other formatting settings +5. Make it so find/replace form can emit Python code that is equivalent to the generated RemesPath query +6. Make RemesPath error messages less confusing +7. Implement a less thread-unsafe way to have ArgFunctions use context: + * Add `uses_context` field to ArgFunction instances, so that they have JQueryContext appended to their arguments, and they can reference fields of that JQueryContext. + * This way we don't have to have these methods mutating and referencing a global static variable. + * Additionally, the presence of a function with `uses_context=true` would serve as a flag that the query cannot be executed in parallel, because doing so would cause race conditions associated with the shared JQueryContext fields. +8. Add `conditional_execution` as a field for ArgFunctions. + * The first function with this set to true would be `ifelse`, but we could also add `and` and `or` non-vectorized functions that work the same as the corresponding functions in Python. + * This would be implemented by adding a vanilla CurJson (with identity function) after the final argument. This CurJson would always be evaluated before the function was evaluated, and would thus provide a reference to input, to allow for conditional evaluation of other arguments. +9. Make it so the regex search form makes a very basic effort to determine the quote character, delimiter, and number of columns in CSV files. + * maybe only try to do this for files with the `.csv` and `.tsv` extensions + * only test the `,` and `\t` delimiters, and only the `"` or `'` quote characters + * test only the first 10KB of the file, or first 25 lines, whichever comes first. + ### To Be Changed - If there's a validation error inside of an `anyOf` list of schemas (i.e. JSON doesn't validate under *any* of the schemas), the error message is rather uninformative, and says only "the JSON didn't validate under any of the schemas", but not *why* it didn't validate. @@ -42,6 +56,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [6.2.0] - (UNRELEASED) YYYY-MM-DD +### Added + +1. A [RemesPath user-defined language (UDL) file](/RemesPath%20UDL.xml), providing some very basic syntax highlighting. It is buggy, but that is because the UDL system is inherently buggy, not because I did anything wrong (as far as I know). + ### Changed 1. The [`ifelse` vectorized function in RemesPath](/docs/RemesPath.md#vectorized-functions) now uses conditional execution. diff --git a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs index a75680d..95e89c4 100644 --- a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs +++ b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("6.1.1.2")] -[assembly: AssemblyFileVersion("6.1.1.2")] +[assembly: AssemblyVersion("6.1.1.3")] +[assembly: AssemblyFileVersion("6.1.1.3")] diff --git a/JsonToolsNppPlugin/Tests/RemesPathTests.cs b/JsonToolsNppPlugin/Tests/RemesPathTests.cs index 172a745..dde6066 100644 --- a/JsonToolsNppPlugin/Tests/RemesPathTests.cs +++ b/JsonToolsNppPlugin/Tests/RemesPathTests.cs @@ -265,8 +265,8 @@ public static bool Test() new Query_DesiredResult("j`[{\"a\": 0,\"b\":-1}, {\"c\":1}, {\"a\":1}, {\"a\":3,\"b\":-4}, 4]`[:3]!.a", "[{\"b\": -1},{\"c\":1}]"), // ufunction tests new Query_DesiredResult("len(@)", fooLen.ToString()), - new Query_DesiredResult("s_mul(@.bar.b, 2)", "[\"a`ga`g\", \"bahbah\"]"), - new Query_DesiredResult("s_mul(@.bar.b{foo: s_slice(@[0], 2), bar: s_slice(@[1], :2), baz: a}, len(@.foo))", "{\"foo\": \"ggg\", \"bar\": \"bababa\", \"baz\": \"aaa\"}"), // vectorized arg functions on objects where second and subsequent args are functions of input + new Query_DesiredResult("s_mul(@.bar.b, len(@.foo) - 1)", "[\"a`ga`g\", \"bahbah\"]"), // vectorized arg function on *arrays* at least one non-first arg is a function of input + new Query_DesiredResult("s_mul(@.bar.b{foo: s_slice(@[0], 2), bar: s_slice(@[1], :2), baz: a}, len(@.foo))", "{\"foo\": \"ggg\", \"bar\": \"bababa\", \"baz\": \"aaa\"}"), // vectorized arg function on *objects* where at least one non-first arg is a function of input new Query_DesiredResult("s_lpad(@{ab, aba, d*7}, cd, 5)", "[\"cdcdab\", \"cdaba\", \"ddddddd\"]"), new Query_DesiredResult("s_lpad(@{ab, c*4}, c, 4)", "[\"ccab\", \"cccc\"]"), new Query_DesiredResult("s_rpad(@{ab, aba, d*7}, cd, 5)", "[\"abcdcd\", \"abacd\", \"ddddddd\"]"), @@ -706,7 +706,7 @@ public static bool Test() } } // the rand() and randint() functions require a special test because their outputs are nondeterministic - ii += 6; + ii += 7; bool test_failed = false; string randints1argQuery = "flatten(@.foo)[:]->randint(1000)"; string randints2argQuery = "range(9)[:]->randint(-700, 800)"; @@ -799,6 +799,26 @@ public static bool Test() Npp.AddLine($"Expected remesparser.Search(j`[1,2,3]`{{{{rand(@)}}}}[0] to return array of doubles that aren't equal, but instead threw" + $" an exception:\n{RemesParser.PrettifyException(ex)}"); } + // make sure that if an array has every value is equal to a variable referencing rand(), + // all values in the array are the same (because they all reference the same variable) + string q = "var foo = range(3); var bar = rand(); foo = bar; foo"; + try + { + result = remesparser.Search(q, foo); + if (!(result is JArray arr && arr[0].value is double d1 && d1 >= 0 && d1 <= 1 && arr.children.All(x => x.value is double xd && xd == d1))) + { + test_failed = true; + tests_failed++; + Npp.AddLine($"Expected remesparser.Search(\"{q}\", foo) to return an array where every value is the same double between 0 and 1, but instead got result {result.ToString()}"); + } + } + catch (Exception ex) + { + test_failed = true; + tests_failed++; + Npp.AddLine($"Expected remesparser.Search(\"{q}\", foo) to return an array where every value is the same double between 0 and 1, but instead got exception {RemesParser.PrettifyException(ex)}"); + } + // randint tests if (firstRandintsIfElse is null || firstRandints1arg is null || firstRandints2args is null) continue; try diff --git a/RemesPath UDL.xml b/RemesPath UDL.xml new file mode 100644 index 0000000..39a9fec --- /dev/null +++ b/RemesPath UDL.xml @@ -0,0 +1,64 @@ + + + + + + + + 00var 00for 00end 01 02= 02= 02; 03 04 + + + + + + + + + + + + + + + + + + + + = + @ + + + + + + 00` 01\ 02` 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/RemesPath.md b/docs/RemesPath.md index b2f1606..3deb9b3 100644 --- a/docs/RemesPath.md +++ b/docs/RemesPath.md @@ -103,13 +103,15 @@ In general, binary operators *should* raise an exception when two objects of une Starting in [v5.4.0](/CHANGELOG.md#540---2023-07-04), all arithmetic operations can accept a boolean as one or both of the arguments. For example, prior to 5.4.0, `true * 3 - (false / 2.5)` was a type error, but since then it is valid. -*Beginning in [v5.1.0](/CHANGELOG.md#510---2023-06-02), the `*` operator in supports multiplication of strings by integers (but not integers by strings). For example, `["a", "b", "c"] * [1,2,3]` will return `["a", "bb", "ccc"]`. Starting in [5.4.0](/CHANGELOG.md), multiplication of a string by a boolean or a negative integer is valid. +Beginning in [v5.1.0](/CHANGELOG.md#510---2023-06-02), the `*` operator in supports multiplication of strings by integers (but not integers by strings). For example, `["a", "b", "c"] * [1,2,3]` will return `["a", "bb", "ccc"]`. Starting in [5.4.0](/CHANGELOG.md), multiplication of a string by a boolean or a negative integer is valid. If you find that a binary operator can operate on a number and a non-number without raising an exception, *this is a bug in my implementation.* ### Unary operators ### -As in normal math, the unary minus operator (e.g., `-5`) has lower precedence than exponentiation. Starting in [5.4.0](/CHANGELOG.md#540---2023-07-04), the unary `+` operator has the same precedence as the unary minus operator. Unary `+` is a no-op on floats and ints, but it converts `true` and `false` to `1` and `0` respectively. +As in normal math, the unary minus operator (e.g., `-5`) has lower precedence than exponentiation and higher precedence than everything else. + +Starting in [5.4.0](/CHANGELOG.md#540---2023-07-04), the unary `+` operator has the same precedence as the unary minus operator. Unary `+` is a no-op on floats and ints, but it converts `true` and `false` to `1` and `0` respectively. The `not` operator introduced in [5.4.0](/CHANGELOG.md#540---2023-07-04) (which replaced [the older function of the same name](#vectorized-functions)) is very similar to the Python operator of the same name: * `not true = false`, `not false = true` @@ -1183,7 +1185,7 @@ If the RHS is a function and the LHS is an iterable, the RHS is applied separate ### Limitations ### 1. Until further notice, you __cannot__ mutate an object or array, other than to change its scalar elements * For example, the query `@ = len(@)` on JSON `[[1, 2, 3]]` will fail, because this ends up trying to mutate the subarray `[1, 2, 3]`. -2. You also cannot mutate a non-array or non-object into an array or object. For example, the query ``@[0] = j`[1]` ``on the input `[0]` will fail because you're trying to convert a scalar (the integer `1`) to an array (`[1]`). +2. You also cannot mutate a non-array or non-object into an array or object. For example, the query ``@[0] = j`[1]` ``on the input `[0]` will fail because you're trying to convert a scalar (the integer `0`) to an array (`[1]`). An assignment expression mutates the input and then returns the input. diff --git a/most recent errors.txt b/most recent errors.txt index be60266..957ab90 100644 --- a/most recent errors.txt +++ b/most recent errors.txt @@ -1,4 +1,4 @@ -Test results for JsonTools v6.1.1.2 on Notepad++ 8.5.8 64bit +Test results for JsonTools v6.1.1.3 on Notepad++ 8.5.8 64bit NOTE: Ctrl-F (regular expressions *on*) for "Failed [1-9]\d*" to find all failed tests Tests failed: YAML dumper ========================= @@ -107,7 +107,7 @@ Testing RemesPath parser and compiler The queried JSON in the RemesParser tests is named foo:{"foo": [[0, 1, 2], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]], "bar": {"a": false, "b": ["a`g", "bah"]}, "baz": "z", "quz": {}, "jub": [], "guzo": [[[1]], [[2], [3]]], "7": [{"foo": 2}, 1], "_": {"0": 0}} Failed 0 tests. -Passed 473 tests. +Passed 474 tests. ========================= Testing RemesPath throws errors on bad inputs ========================= @@ -195,33 +195,33 @@ Testing JsonParser performance Preview of json: [{"A": "Ky'c^g#~)0", "a": 1850111954, "b": 9318359041, "B": "Oyi:/ xxe2", "C": "sKCSa_^7Gg", "c": 7974777124, "d": 2670309238, "D": "0d_K)HmX!.", "E": ".uM*Z{0EJ_", "e": 6958410336, "f": 8050244728, "F": "1%SG_A!xB\t", "g": 3799657125, "G": "il1^k\\\nat*", "H": {"a": 6079042826, "b": 7292804611, "c" ... -To convert JSON string of size 89556 into JNode took 4.048 +/- 2.229 ms over 32 trials -Load times (ms): 4, 12, 5, 5, 2, 2, 2, 3, 1, 1, 6, 2, 2, 2, 4, 2, 2, 7, 2, 2, 3, 4, 2, 2, 3, 3, 3, 5, 4, 6, 6, 2 +To convert JSON string of size 89556 into JNode took 3.304 +/- 1.695 ms over 32 trials +Load times (ms): 7, 6, 2, 6, 5, 2, 2, 2, 3, 2, 1, 5, 2, 1, 1, 3, 2, 1, 5, 1, 1, 1, 3, 1, 1, 6, 2, 2, 2, 5, 2, 2 ========================= Performance tests for RemesPath (float arithmetic) ========================= -Compiling query "@[@[:].a * @[:].t < @[:].e]" took 0.095 ms the first time, including approximately 0.112 ms to tokenize the query. Subsequent executions are effectively free due to caching. -To run pre-compiled query "@[@[:].a * @[:].t < @[:].e]" on JNode from JSON of size 89556 into took 0.044 +/- 0.007 ms over 40 trials -Query times (ms): 0.07, 0.051, 0.038, 0.037, 0.035, 0.036, 0.035, 0.048, 0.045, 0.045, 0.044, 0.046, 0.046, 0.051, 0.042, 0.041, 0.041, 0.042, 0.043, 0.047, 0.044, 0.042, 0.039, 0.041, 0.033, 0.052, 0.061, 0.044, 0.045, 0.044, 0.045, 0.053, 0.041, 0.051, 0.04, 0.042, 0.042, 0.046, 0.042, 0.04 +Compiling query "@[@[:].a * @[:].t < @[:].e]" took 0.099 ms the first time, including approximately 0.124 ms to tokenize the query. Subsequent executions are effectively free due to caching. +To run pre-compiled query "@[@[:].a * @[:].t < @[:].e]" on JNode from JSON of size 89556 into took 0.181 +/- 0.778 ms over 40 trials +Query times (ms): 0.085, 0.083, 0.042, 0.042, 0.04, 0.043, 0.044, 0.247, 0.043, 0.04, 0.04, 0.05, 0.04, 0.091, 0.046, 0.046, 0.039, 0.04, 0.053, 0.059, 0.046, 0.045, 0.048, 0.054, 0.046, 0.064, 0.061, 0.054, 0.048, 5.036, 0.079, 0.051, 0.046, 0.047, 0.044, 0.046, 0.056, 0.052, 0.046, 0.047 Preview of result: [{"A": "Ky'c^g#~)0", "a": 1850111954, "b": 9318359041, "B": "Oyi:/ xxe2", "C": "sKCSa_^7Gg", "c": 7974777124, "d": 2670309238, "D": "0d_K)HmX!.", "E": ".uM*Z{0EJ_", "e": 6958410336, "f": 8050244728, "F": "1%SG_A!xB\t", "g": 3799657125, "G": "il1^k\\\nat*", "H": {"a": 6079042826, "b": 7292804611, "c" ... ========================= Performance tests for RemesPath (string operations) ========================= -Compiling query "@[@[:].z =~ `(?i)[a-z]{5}`]" took 0.05 ms the first time, including approximately 0.051 ms to tokenize the query. Subsequent executions are effectively free due to caching. -To run pre-compiled query "@[@[:].z =~ `(?i)[a-z]{5}`]" on JNode from JSON of size 89556 into took 0.104 +/- 0.018 ms over 40 trials -Query times (ms): 0.148, 0.105, 0.099, 0.097, 0.191, 0.127, 0.103, 0.101, 0.091, 0.088, 0.09, 0.094, 0.101, 0.122, 0.121, 0.095, 0.092, 0.092, 0.096, 0.099, 0.099, 0.111, 0.094, 0.088, 0.095, 0.104, 0.097, 0.096, 0.109, 0.096, 0.099, 0.114, 0.104, 0.096, 0.097, 0.105, 0.098, 0.099, 0.124, 0.091 +Compiling query "@[@[:].z =~ `(?i)[a-z]{5}`]" took 0.058 ms the first time, including approximately 0.071 ms to tokenize the query. Subsequent executions are effectively free due to caching. +To run pre-compiled query "@[@[:].z =~ `(?i)[a-z]{5}`]" on JNode from JSON of size 89556 into took 0.06 +/- 0.015 ms over 40 trials +Query times (ms): 0.146, 0.085, 0.058, 0.054, 0.061, 0.055, 0.06, 0.084, 0.055, 0.053, 0.062, 0.054, 0.054, 0.057, 0.056, 0.061, 0.056, 0.055, 0.056, 0.056, 0.055, 0.06, 0.053, 0.054, 0.062, 0.057, 0.054, 0.061, 0.054, 0.053, 0.054, 0.053, 0.055, 0.059, 0.053, 0.052, 0.053, 0.054, 0.052, 0.06 Preview of result: [{"A": "\n]o1VQ5t6g", "a": 4710024278, "b": 3268860721, "B": "g4Y7+ew^.v", "C": "NK nmax_notq, `when q=true, nmax = ` + str(nmax_q), `when q=false, nmax= ` + str(nmax_notq))" took 0.21 ms the first time, including approximately 0.202 ms to tokenize the query. Subsequent executions are effectively free due to caching. +ifelse(nmax_q > nmax_notq, `when q=true, nmax = ` + str(nmax_q), `when q=false, nmax= ` + str(nmax_notq))" took 0.25 ms the first time, including approximately 0.252 ms to tokenize the query. Subsequent executions are effectively free due to caching. To run pre-compiled query "var qmask = @[:].q; var nmax_q = max(@[qmask].n); var nmax_notq = max(@[not qmask].n); -ifelse(nmax_q > nmax_notq, `when q=true, nmax = ` + str(nmax_q), `when q=false, nmax= ` + str(nmax_notq))" on JNode from JSON of size 89556 into took 0.035 +/- 0.013 ms over 40 trials -Query times (ms): 0.111, 0.035, 0.032, 0.031, 0.032, 0.034, 0.032, 0.031, 0.032, 0.03, 0.031, 0.031, 0.032, 0.032, 0.032, 0.032, 0.032, 0.03, 0.032, 0.032, 0.032, 0.033, 0.032, 0.033, 0.032, 0.033, 0.031, 0.033, 0.035, 0.067, 0.034, 0.033, 0.032, 0.032, 0.032, 0.031, 0.032, 0.031, 0.032, 0.044 +ifelse(nmax_q > nmax_notq, `when q=true, nmax = ` + str(nmax_q), `when q=false, nmax= ` + str(nmax_notq))" on JNode from JSON of size 89556 into took 0.038 +/- 0.016 ms over 40 trials +Query times (ms): 0.115, 0.09, 0.033, 0.042, 0.032, 0.032, 0.031, 0.033, 0.032, 0.043, 0.063, 0.033, 0.041, 0.032, 0.033, 0.028, 0.032, 0.029, 0.033, 0.028, 0.028, 0.03, 0.031, 0.041, 0.031, 0.032, 0.036, 0.035, 0.034, 0.036, 0.039, 0.038, 0.036, 0.046, 0.039, 0.034, 0.029, 0.034, 0.029, 0.028 Preview of result: "when q=false, nmax= 9830935647.0" ... ========================= @@ -260,11 +260,11 @@ Performance tests for RemesPath (references to compile-time constant variables) Compiling query "var X = X; var onetwo = j`[1, 2]`; -@[:]->at(@, X)->at(@, onetwo)" took 0.132 ms the first time, including approximately 0.126 ms to tokenize the query. Subsequent executions are effectively free due to caching. +@[:]->at(@, X)->at(@, onetwo)" took 0.123 ms the first time, including approximately 0.171 ms to tokenize the query. Subsequent executions are effectively free due to caching. To run pre-compiled query "var X = X; var onetwo = j`[1, 2]`; -@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.027 +/- 0.006 ms over 40 trials -Query times (ms): 0.063, 0.028, 0.025, 0.024, 0.026, 0.024, 0.024, 0.039, 0.025, 0.025, 0.024, 0.025, 0.025, 0.024, 0.024, 0.025, 0.024, 0.024, 0.024, 0.026, 0.025, 0.035, 0.026, 0.025, 0.025, 0.025, 0.024, 0.026, 0.026, 0.025, 0.027, 0.026, 0.026, 0.025, 0.025, 0.034, 0.027, 0.024, 0.026, 0.026 +@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.036 +/- 0.057 ms over 40 trials +Query times (ms): 0.12, 0.037, 0.023, 0.023, 0.022, 0.023, 0.023, 0.023, 0.034, 0.025, 0.027, 0.033, 0.023, 0.023, 0.024, 0.38, 0.033, 0.023, 0.024, 0.024, 0.022, 0.023, 0.022, 0.032, 0.024, 0.022, 0.022, 0.023, 0.022, 0.022, 0.022, 0.024, 0.024, 0.027, 0.024, 0.024, 0.021, 0.028, 0.031, 0.023 Preview of result: [[1695727848, 0.287562638736685], [2126430375, 0.00767794129708177], [5310550656, 0.380769772645687], [2519183283, 0.153176220930558], [6610062385, 0.662996225870666], [987168256, 0.924410189999928], [6615003609, 0.917112691225947], [4465232046, 0.684311931851536], [8654414565, 0.631485392105992], [ ... ========================= @@ -273,29 +273,29 @@ Performance tests for RemesPath (references to variables that are not compile-ti Compiling query "var X = @->`X`; var onetwo = @{1, 2}; -@[:]->at(@, X)->at(@, onetwo)" took 0.128 ms the first time, including approximately 0.439 ms to tokenize the query. Subsequent executions are effectively free due to caching. +@[:]->at(@, X)->at(@, onetwo)" took 0.132 ms the first time, including approximately 0.163 ms to tokenize the query. Subsequent executions are effectively free due to caching. To run pre-compiled query "var X = @->`X`; var onetwo = @{1, 2}; -@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.037 +/- 0.01 ms over 40 trials -Query times (ms): 0.081, 0.031, 0.046, 0.036, 0.036, 0.036, 0.035, 0.035, 0.037, 0.037, 0.035, 0.037, 0.05, 0.038, 0.038, 0.036, 0.036, 0.034, 0.037, 0.032, 0.033, 0.072, 0.032, 0.036, 0.036, 0.035, 0.033, 0.033, 0.028, 0.028, 0.029, 0.045, 0.032, 0.03, 0.033, 0.033, 0.036, 0.031, 0.031, 0.033 +@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.035 +/- 0.02 ms over 40 trials +Query times (ms): 0.154, 0.041, 0.033, 0.031, 0.033, 0.031, 0.029, 0.033, 0.057, 0.03, 0.03, 0.03, 0.028, 0.031, 0.031, 0.031, 0.029, 0.03, 0.03, 0.03, 0.04, 0.029, 0.03, 0.031, 0.028, 0.03, 0.031, 0.03, 0.03, 0.031, 0.03, 0.039, 0.032, 0.031, 0.03, 0.03, 0.03, 0.028, 0.029, 0.03 Preview of result: [[1695727848, 0.287562638736685], [2126430375, 0.00767794129708177], [5310550656, 0.380769772645687], [2519183283, 0.153176220930558], [6610062385, 0.662996225870666], [987168256, 0.924410189999928], [6615003609, 0.917112691225947], [4465232046, 0.684311931851536], [8654414565, 0.631485392105992], [ ... ========================= Performance tests for RemesPath (simple string mutations) ========================= -Compiling query "@[:].z = s_sub(@, g, B)" took 0.077 ms the first time, including approximately 0.089 ms to tokenize the query. Subsequent executions are effectively free due to caching. +Compiling query "@[:].z = s_sub(@, g, B)" took 0.074 ms the first time, including approximately 0.07 ms to tokenize the query. Subsequent executions are effectively free due to caching. To run pre-compiled query "@[:].z = s_sub(@, g, B)" on JNode from JSON of size 89556 into took 0.031 +/- 0.008 ms over 40 trials -Query times (ms): 0.045, 0.039, 0.038, 0.023, 0.033, 0.026, 0.024, 0.044, 0.03, 0.028, 0.032, 0.038, 0.046, 0.039, 0.053, 0.042, 0.037, 0.033, 0.03, 0.033, 0.028, 0.044, 0.027, 0.023, 0.024, 0.029, 0.023, 0.025, 0.022, 0.026, 0.026, 0.031, 0.026, 0.03, 0.04, 0.027, 0.022, 0.028, 0.022, 0.021 +Query times (ms): 0.048, 0.042, 0.038, 0.024, 0.026, 0.056, 0.031, 0.04, 0.047, 0.032, 0.033, 0.031, 0.035, 0.036, 0.033, 0.04, 0.03, 0.026, 0.026, 0.029, 0.027, 0.024, 0.026, 0.026, 0.024, 0.026, 0.031, 0.032, 0.042, 0.05, 0.027, 0.026, 0.021, 0.022, 0.027, 0.025, 0.025, 0.03, 0.024, 0.023 Preview of result: [{"A": "Ky'c^g#~)0", "a": 1850111954, "b": 9318359041, "B": "Oyi:/ xxe2", "C": "sKCSa_^7Gg", "c": 7974777124, "d": 2670309238, "D": "0d_K)HmX!.", "E": ".uM*Z{0EJ_", "e": 6958410336, "f": 8050244728, "F": "1%SG_A!xB\t", "g": 3799657125, "G": "il1^k\\\nat*", "H": {"a": 6079042826, "b": 7292804611, "c" ... ========================= Performance tests for RemesPath (simple number mutations) ========================= -Compiling query "@[:].x = ifelse(@ < 0.5, @ + 3, @ - 3)" took 0.096 ms the first time, including approximately 0.092 ms to tokenize the query. Subsequent executions are effectively free due to caching. -To run pre-compiled query "@[:].x = ifelse(@ < 0.5, @ + 3, @ - 3)" on JNode from JSON of size 89556 into took 0.098 +/- 0.35 ms over 40 trials -Query times (ms): 0.053, 0.044, 0.039, 0.039, 0.047, 0.043, 0.047, 0.051, 0.041, 0.034, 0.041, 0.034, 0.034, 0.035, 0.032, 0.034, 0.034, 0.039, 0.048, 0.044, 0.052, 0.041, 0.042, 0.037, 0.064, 0.04, 0.038, 0.033, 2.281, 0.042, 0.036, 0.038, 0.03, 0.041, 0.039, 0.064, 0.05, 0.055, 0.051, 0.055 +Compiling query "@[:].x = ifelse(@ < 0.5, @ + 3, @ - 3)" took 0.127 ms the first time, including approximately 0.18 ms to tokenize the query. Subsequent executions are effectively free due to caching. +To run pre-compiled query "@[:].x = ifelse(@ < 0.5, @ + 3, @ - 3)" on JNode from JSON of size 89556 into took 0.044 +/- 0.011 ms over 40 trials +Query times (ms): 0.069, 0.055, 0.043, 0.037, 0.036, 0.04, 0.036, 0.038, 0.034, 0.044, 0.043, 0.041, 0.056, 0.043, 0.051, 0.041, 0.046, 0.049, 0.042, 0.046, 0.044, 0.044, 0.059, 0.046, 0.046, 0.046, 0.06, 0.092, 0.052, 0.036, 0.034, 0.04, 0.031, 0.032, 0.035, 0.033, 0.039, 0.047, 0.032, 0.034 Preview of result: [{"A": "Ky'c^g#~)0", "a": 1850111954, "b": 9318359041, "B": "Oyi:/ xxe2", "C": "sKCSa_^7Gg", "c": 7974777124, "d": 2670309238, "D": "0d_K)HmX!.", "E": ".uM*Z{0EJ_", "e": 6958410336, "f": 8050244728, "F": "1%SG_A!xB\t", "g": 3799657125, "G": "il1^k\\\nat*", "H": {"a": 6079042826, "b": 7292804611, "c" ... ========================= @@ -305,12 +305,12 @@ Performance tests for RemesPath (mutations with a for loop) Compiling query "var xhalf = @[:].x < 0.5; for lx = zip(@[:].l, xhalf); lx[0] = ifelse(lx[1], foo, bar); -end for;" took 0.249 ms the first time, including approximately 0.201 ms to tokenize the query. Subsequent executions are effectively free due to caching. +end for;" took 0.222 ms the first time, including approximately 1.466 ms to tokenize the query. Subsequent executions are effectively free due to caching. To run pre-compiled query "var xhalf = @[:].x < 0.5; for lx = zip(@[:].l, xhalf); lx[0] = ifelse(lx[1], foo, bar); -end for;" on JNode from JSON of size 89556 into took 0.087 +/- 0.016 ms over 40 trials -Query times (ms): 0.111, 0.079, 0.073, 0.076, 0.098, 0.105, 0.084, 0.092, 0.087, 0.114, 0.085, 0.084, 0.086, 0.099, 0.083, 0.09, 0.093, 0.114, 0.111, 0.103, 0.081, 0.115, 0.115, 0.101, 0.073, 0.068, 0.083, 0.077, 0.069, 0.062, 0.094, 0.067, 0.064, 0.069, 0.092, 0.069, 0.064, 0.065, 0.093, 0.074 +end for;" on JNode from JSON of size 89556 into took 0.136 +/- 0.244 ms over 40 trials +Query times (ms): 0.139, 0.087, 0.086, 0.086, 0.085, 0.099, 0.092, 0.089, 0.087, 0.079, 0.089, 0.12, 0.14, 0.091, 0.087, 0.082, 0.102, 0.097, 0.08, 0.083, 1.658, 0.137, 0.102, 0.098, 0.092, 0.129, 0.083, 0.088, 0.081, 0.116, 0.108, 0.111, 0.112, 0.117, 0.087, 0.082, 0.083, 0.093, 0.083, 0.082 Preview of result: [["bar", false], ["bar", false], ["foo", true], ["foo", true], ["foo", true], ["foo", true], ["foo", true], ["bar", false], ["bar", false], ["bar", false], ["foo", true], ["foo", true], ["bar", false], ["bar", false], ["foo", true], ["bar", false], ["bar", false], ["bar", false], ["foo", true], ["ba ... ========================= @@ -319,18 +319,18 @@ Testing performance of JSON compression and pretty-printing Preview of json: [{"A": "Ky'c^g#~)0", "a": 1850111954, "b": 9318359041, "B": "Oyi:/ xxe2", "C": "sKCSa_^7Gg", "c": 7974777124, "d": 2670309238, "D": "0d_K)HmX!.", "E": ".uM*Z{0EJ_", "e": 6958410336, "f": 8050244728, "F": "1%SG_A!xB\t", "g": 3799657125, "G": "il1^k\\\nat*", "H": {"a": 6079042826, "b": 7292804611, "c" ... -To compress JNode from JSON string of 89556 took 4.595 +/- 1.253 ms over 64 trials (minimal whitespace, sort_keys=TRUE) -To compress JNode from JSON string of 89556 took 2.063 +/- 0.24 ms over 64 trials (minimal whitespace, sort_keys=FALSE) -To Google-style pretty-print JNode from JSON string of 89556 took 4.311 +/- 0.408 ms over 64 trials (sort_keys=true, indent=4) -To Whitesmith-style pretty-print JNode from JSON string of 89556 took 4.374 +/- 0.616 ms over 64 trials (sort_keys=true, indent=4) -To PPrint-style pretty-print JNode from JSON string of 89556 took 6.838 +/- 1.01 ms over 64 trials (sort_keys=true, indent=4) +To compress JNode from JSON string of 89556 took 6.68 +/- 1.892 ms over 64 trials (minimal whitespace, sort_keys=TRUE) +To compress JNode from JSON string of 89556 took 2.453 +/- 0.634 ms over 64 trials (minimal whitespace, sort_keys=FALSE) +To Google-style pretty-print JNode from JSON string of 89556 took 4.821 +/- 1.152 ms over 64 trials (sort_keys=true, indent=4) +To Whitesmith-style pretty-print JNode from JSON string of 89556 took 5.137 +/- 1.359 ms over 64 trials (sort_keys=true, indent=4) +To PPrint-style pretty-print JNode from JSON string of 89556 took 8.665 +/- 3.559 ms over 64 trials (sort_keys=true, indent=4) ========================= Testing performance of JsonSchemaValidator and random JSON creation ========================= -To create a random set of tweet JSON of size 202191 (15 tweets) based on the matching schema took 6.484 +/- 3.051 ms over 64 trials -To compile the tweet schema to a validation function took 0.258 +/- 0.35 ms over 64 trials -To validate tweet JSON of size 202191 (15 tweets) based on the compiled schema took 1.076 +/- 0.205 ms over 64 trials +To create a random set of tweet JSON of size 172095 (15 tweets) based on the matching schema took 7.77 +/- 3.606 ms over 64 trials +To compile the tweet schema to a validation function took 0.608 +/- 1.367 ms over 64 trials +To validate tweet JSON of size 172095 (15 tweets) based on the compiled schema took 1.272 +/- 0.292 ms over 64 trials ========================= Testing JSON grepper's API request tool =========================