diff --git a/CHANGELOG.md b/CHANGELOG.md index 773f51e..93f6553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). 1. If there would be an `OutOfMemoryException` due to running out of memory while formatting JSON (a likely occurrence when using the `grepper form`), that error is caught and reported with a message box, rather than potentially causing Notepad++ to crash. 2. Ensure that hitting the down key does nothing when the last row of the [error form](/docs/README.md#error-form-and-status-bar) is selected. +3. Fix bug with [random json from schema](/docs/README.md#generating-random-json-from-a-schema) when parsing a schema that has the `enum` key but not the `type` key. ## [8.0.0] - 2024-06-29 diff --git a/JsonToolsNppPlugin/JSONTools/RandomJsonFromSchema.cs b/JsonToolsNppPlugin/JSONTools/RandomJsonFromSchema.cs index f71e705..2dc1998 100644 --- a/JsonToolsNppPlugin/JSONTools/RandomJsonFromSchema.cs +++ b/JsonToolsNppPlugin/JSONTools/RandomJsonFromSchema.cs @@ -286,12 +286,18 @@ public static JNode RandomJsonHelper(JNode schema, JObject refs, int minArrayLen } if (obj.Length == 0) // the empty schema validates everything return RandomAnything(new JObject(), new JObject(), minArrayLength, maxArrayLength, extendedAsciiStrings); + if (obj.children.TryGetValue("enum", out JNode enum_)) + { + // any type can be an enum; it's just a list of possible values + List enumMembers = ((JArray)enum_).children; + return enumMembers[random.Next(enumMembers.Count)].Copy(); + } if (!obj.children.TryGetValue("type", out JNode typeNode)) { if (!obj.children.TryGetValue("anyOf", out JNode anyOf)) { if (!obj.children.TryGetValue("$ref", out JNode refnode)) - throw new SchemaValidationException("A schema must have an \"anyOf\" keyword or a \"type\" keyword"); + throw new SchemaValidationException("A schema must have at least one of the \"type\", \"enum\", \"anyOf\" keywords."); var refname = ((string)refnode.value).Split('/').Last(); if (!refs.children.TryGetValue(refname, out JNode reference)) throw new SchemaValidationException($"Reference {refname} to an undefined schema"); @@ -299,12 +305,6 @@ public static JNode RandomJsonHelper(JNode schema, JObject refs, int minArrayLen } return RandomAnyOf(anyOf, refs, minArrayLength, maxArrayLength, extendedAsciiStrings); } - if (obj.children.TryGetValue("enum", out JNode enum_)) - { - // any type can be an enum; it's just a list of possible values - List enumMembers = ((JArray)enum_).children; - return enumMembers[random.Next(enumMembers.Count)].Copy(); - } if (typeNode is JArray typeArr) { // multiple scalar types possible diff --git a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs index d68a650..d664ffc 100644 --- a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs +++ b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("8.0.0.15")] -[assembly: AssemblyFileVersion("8.0.0.15")] +[assembly: AssemblyVersion("8.0.0.16")] +[assembly: AssemblyFileVersion("8.0.0.16")] diff --git a/JsonToolsNppPlugin/Tests/RandomJsonTests.cs b/JsonToolsNppPlugin/Tests/RandomJsonTests.cs index edd862e..5cd4ed1 100644 --- a/JsonToolsNppPlugin/Tests/RandomJsonTests.cs +++ b/JsonToolsNppPlugin/Tests/RandomJsonTests.cs @@ -175,7 +175,7 @@ public static bool TestRandomJson() } } // also test a schema that contains keywords that can't be generated randomly, like contains, minContains, minItems, maxItems, maxContains, and $defs/$ref - var kitchenSinkSchemaText = "{\"$defs\":{\"super_fancy\":{\"properties\":{\"b\":{\"anyOf\":[{\"type\": [\"integer\",\"string\"]},{\"contains\":{\"enum\":[1,2,3], \"type\":\"integer\"},\"items\": {\"type\": \"string\", \"minLength\": 3, \"maxLength\": 6},\"maxContains\":2,\"maxItems\":4,\"minContains\":1,\"minItems\":1,\"type\":\"array\"}]},\"c\":{\"type\":[\"integer\",\"null\"]},\"d\": {\"type\": \"boolean\"}},\"required\":[\"b\"],\"type\":\"object\"}},\"$schema\":\"http://json-schema.org/schema#\",\"items\":{\"properties\":{\"a\":{\"type\":\"number\", \"minimum\": -20, \"maximum\": 20},\"b\": {\"items\": {\"properties\": {\"a\": {\"$ref\": \"#/$defs/super_fancy\"}},\"required\":[\"a\"],\"type\":\"object\"},\"type\":\"array\"},\"c\": {\"type\": \"integer\"}},\"required\":[\"a\"],\"type\":\"object\"},\"type\":\"array\"}"; + var kitchenSinkSchemaText = "{\"$defs\":{\"super_fancy\":{\"properties\":{\"b\":{\"anyOf\":[{\"type\": [\"integer\",\"string\"]},{\"contains\":{\"enum\":[1,2.5,true,\"\"]},\"items\": {\"type\": \"string\", \"minLength\": 3, \"maxLength\": 6},\"maxContains\":2,\"maxItems\":4,\"minContains\":1,\"minItems\":1,\"type\":\"array\"}]},\"c\":{\"type\":[\"integer\",\"null\"]},\"d\": {\"type\": \"boolean\"}},\"required\":[\"b\"],\"type\":\"object\"}},\"$schema\":\"http://json-schema.org/schema#\",\"items\":{\"properties\":{\"a\":{\"type\":\"number\", \"minimum\": -20, \"maximum\": 20},\"b\": {\"items\": {\"properties\": {\"a\": {\"$ref\": \"#/$defs/super_fancy\"}},\"required\":[\"a\"],\"type\":\"object\"},\"type\":\"array\"},\"c\": {\"type\": \"integer\"}},\"required\":[\"a\"],\"type\":\"object\"},\"type\":\"array\"}"; var kitchenSinkSchema = parser.Parse(kitchenSinkSchemaText); ii++; for (int i = 0; i < 200; i++) diff --git a/README.md b/README.md index ad735a1..f009448 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,8 @@ JsonTools infers your preferred language and attempts to translate in the follow JsonTools only attempts to find translation files once, when Notepad++ is starting up. If you change the UI language of Notepad++ or your operating system's UI culture, you will have to close Notepad++ and reopen it before this change will apply to JsonTools. +To be clear, *JsonTools may not be in the same language of the Notepad++ UI.* The steps described above represent my best effort to automatically translate JsonTools into a language that the user will find useful, without requiring the user to select their language from a list of available languages in the settings form. + To translate JsonTools to another language, just look at [`english.json5` in the translations directory of this repo](https://github.com/molsonkiko/JsonToolsNppPlugin/blob/main/translation/english.json5) and follow the instructions in that file. Currently JsonTools has been translated into the following languages: diff --git a/most recent errors.txt b/most recent errors.txt index 91dfea6..3448b1c 100644 --- a/most recent errors.txt +++ b/most recent errors.txt @@ -1,4 +1,4 @@ -Test results for JsonTools v8.0.0.13 on Notepad++ 8.6.9 64bit +Test results for JsonTools v8.0.0.16 on Notepad++ 8.6.9 64bit NOTE: Ctrl-F (regular expressions *on*) for "Failed [1-9]\d*" to find all failed tests Tests failed: YAML dumper ========================= @@ -206,33 +206,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 2.94 +/- 2.323 ms over 32 trials -Load times (ms): 2, 1, 2, 6, 1, 1, 1, 11, 1, 1, 5, 1, 1, 1, 4, 1, 1, 6, 1, 1, 2, 4, 1, 1, 6, 1, 1, 1, 4, 1, 1, 6 +To convert JSON string of size 89556 into JNode took 3.563 +/- 3.154 ms over 32 trials +Load times (ms): 2, 8, 2, 2, 2, 6, 2, 2, 8, 1, 2, 2, 6, 1, 1, 7, 1, 1, 2, 16, 1, 2, 6, 1, 1, 2, 4, 1, 1, 6, 1, 1 ========================= Performance tests for RemesPath (float arithmetic) ========================= -Compiling query "@[@[:].a * @[:].t < @[:].e]" took 0.066 ms the first time, including approximately 0.063 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.024 +/- 0.006 ms over 40 trials -Query times (ms): 0.061, 0.03, 0.022, 0.022, 0.022, 0.022, 0.022, 0.025, 0.022, 0.022, 0.022, 0.022, 0.022, 0.024, 0.022, 0.022, 0.023, 0.022, 0.022, 0.024, 0.023, 0.022, 0.022, 0.022, 0.022, 0.03, 0.022, 0.023, 0.022, 0.022, 0.022, 0.024, 0.028, 0.022, 0.022, 0.023, 0.022, 0.024, 0.027, 0.023 +Compiling query "@[@[:].a * @[:].t < @[:].e]" took 0.073 ms the first time, including approximately 0.067 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.036 +/- 0.007 ms over 40 trials +Query times (ms): 0.072, 0.045, 0.04, 0.038, 0.035, 0.032, 0.032, 0.042, 0.034, 0.044, 0.039, 0.039, 0.038, 0.042, 0.033, 0.043, 0.039, 0.036, 0.033, 0.041, 0.032, 0.031, 0.031, 0.034, 0.031, 0.033, 0.032, 0.034, 0.032, 0.031, 0.035, 0.034, 0.032, 0.032, 0.036, 0.031, 0.032, 0.033, 0.035, 0.03 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.06 ms the first time, including approximately 0.052 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.058 +/- 0.011 ms over 40 trials -Query times (ms): 0.109, 0.1, 0.058, 0.055, 0.061, 0.054, 0.054, 0.054, 0.054, 0.054, 0.06, 0.054, 0.054, 0.054, 0.055, 0.054, 0.06, 0.055, 0.054, 0.055, 0.054, 0.054, 0.059, 0.054, 0.055, 0.055, 0.055, 0.054, 0.06, 0.054, 0.054, 0.054, 0.055, 0.053, 0.06, 0.054, 0.055, 0.054, 0.053, 0.054 +Compiling query "@[@[:].z =~ `(?i)[a-z]{5}`]" took 0.039 ms the first time, including approximately 0.04 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.054 +/- 0.007 ms over 40 trials +Query times (ms): 0.095, 0.057, 0.054, 0.053, 0.052, 0.054, 0.052, 0.053, 0.054, 0.052, 0.053, 0.052, 0.053, 0.053, 0.054, 0.053, 0.053, 0.054, 0.052, 0.053, 0.053, 0.053, 0.052, 0.052, 0.052, 0.052, 0.053, 0.053, 0.052, 0.053, 0.053, 0.053, 0.052, 0.052, 0.053, 0.052, 0.053, 0.052, 0.053, 0.052 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.147 ms the first time, including approximately 0.119 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.176 ms the first time, including approximately 0.118 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.023 +/- 0.036 ms over 40 trials -Query times (ms): 0.068, 0.034, 0.016, 0.016, 0.015, 0.015, 0.016, 0.016, 0.016, 0.015, 0.016, 0.015, 0.015, 0.015, 0.015, 0.016, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.016, 0.023, 0.016, 0.015, 0.016, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.016, 0.015, 0.015, 0.015, 0.015, 0.243, 0.019 +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.017 +/- 0.008 ms over 40 trials +Query times (ms): 0.068, 0.017, 0.016, 0.018, 0.016, 0.015, 0.016, 0.016, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.016, 0.015, 0.016, 0.015, 0.015, 0.015, 0.016, 0.015, 0.015, 0.016, 0.016, 0.016, 0.015, 0.016, 0.015, 0.016, 0.015, 0.016, 0.015, 0.015, 0.015, 0.016, 0.015, 0.016 Preview of result: "when q=false, nmax= 9830935647.0" ... ========================= @@ -271,11 +271,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.087 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.102 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 "var X = X; var onetwo = j`[1, 2]`; -@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.013 +/- 0.006 ms over 40 trials -Query times (ms): 0.049, 0.013, 0.013, 0.012, 0.012, 0.014, 0.013, 0.012, 0.012, 0.012, 0.013, 0.012, 0.012, 0.013, 0.012, 0.012, 0.012, 0.025, 0.012, 0.013, 0.012, 0.012, 0.012, 0.013, 0.013, 0.012, 0.012, 0.012, 0.012, 0.012, 0.012, 0.013, 0.012, 0.012, 0.012, 0.012, 0.012, 0.013, 0.012, 0.012 +@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.019 +/- 0.038 ms over 40 trials +Query times (ms): 0.041, 0.013, 0.012, 0.013, 0.013, 0.012, 0.012, 0.012, 0.012, 0.013, 0.012, 0.012, 0.013, 0.012, 0.014, 0.012, 0.013, 0.014, 0.013, 0.013, 0.012, 0.013, 0.015, 0.014, 0.013, 0.255, 0.015, 0.012, 0.012, 0.012, 0.012, 0.012, 0.012, 0.012, 0.011, 0.012, 0.011, 0.012, 0.012, 0.011 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], [ ... ========================= @@ -284,29 +284,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.105 ms the first time, including approximately 0.119 ms to tokenize the query. Subsequent executions are effectively free due to caching. +@[:]->at(@, X)->at(@, onetwo)" took 0.077 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 "var X = @->`X`; var onetwo = @{1, 2}; -@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.021 +/- 0.013 ms over 40 trials -Query times (ms): 0.085, 0.017, 0.016, 0.025, 0.016, 0.016, 0.046, 0.016, 0.016, 0.016, 0.016, 0.018, 0.05, 0.016, 0.031, 0.017, 0.015, 0.015, 0.044, 0.015, 0.016, 0.016, 0.015, 0.016, 0.023, 0.016, 0.016, 0.016, 0.015, 0.017, 0.015, 0.016, 0.016, 0.015, 0.016, 0.016, 0.015, 0.016, 0.016, 0.016 +@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.016 +/- 0.003 ms over 40 trials +Query times (ms): 0.033, 0.016, 0.015, 0.015, 0.021, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.014, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.016, 0.015, 0.015, 0.016, 0.015, 0.015, 0.015, 0.016, 0.015, 0.015, 0.016, 0.015, 0.015, 0.016, 0.015, 0.016 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.051 ms the first time, including approximately 0.046 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.014 +/- 0.004 ms over 40 trials -Query times (ms): 0.027, 0.018, 0.013, 0.009, 0.01, 0.012, 0.012, 0.014, 0.015, 0.016, 0.017, 0.014, 0.018, 0.016, 0.027, 0.014, 0.011, 0.013, 0.012, 0.013, 0.01, 0.012, 0.016, 0.012, 0.01, 0.014, 0.014, 0.014, 0.017, 0.02, 0.011, 0.01, 0.023, 0.013, 0.011, 0.011, 0.011, 0.011, 0.011, 0.012 +Compiling query "@[:].z = s_sub(@, g, B)" took 0.037 ms the first time, including approximately 0.034 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.016 +/- 0.013 ms over 40 trials +Query times (ms): 0.021, 0.011, 0.017, 0.009, 0.011, 0.013, 0.012, 0.014, 0.014, 0.013, 0.02, 0.012, 0.012, 0.013, 0.013, 0.076, 0.028, 0.029, 0.061, 0.014, 0.01, 0.011, 0.01, 0.011, 0.01, 0.009, 0.014, 0.013, 0.014, 0.015, 0.011, 0.01, 0.011, 0.01, 0.013, 0.01, 0.011, 0.016, 0.013, 0.012 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.057 ms the first time, including approximately 0.061 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.032 +/- 0.013 ms over 40 trials -Query times (ms): 0.053, 0.036, 0.032, 0.038, 0.037, 0.032, 0.031, 0.025, 0.023, 0.019, 0.019, 0.037, 0.03, 0.037, 0.026, 0.024, 0.02, 0.021, 0.033, 0.026, 0.02, 0.018, 0.019, 0.018, 0.024, 0.026, 0.023, 0.058, 0.064, 0.08, 0.03, 0.039, 0.04, 0.041, 0.04, 0.038, 0.033, 0.02, 0.02, 0.025 +Compiling query "@[:].x = ifelse(@ < 0.5, @ + 3, @ - 3)" took 0.072 ms the first time, including approximately 0.069 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.037 +/- 0.035 ms over 40 trials +Query times (ms): 0.061, 0.046, 0.04, 0.026, 0.02, 0.02, 0.017, 0.018, 0.017, 0.018, 0.247, 0.023, 0.02, 0.029, 0.043, 0.033, 0.02, 0.018, 0.036, 0.04, 0.038, 0.032, 0.032, 0.033, 0.031, 0.033, 0.031, 0.039, 0.052, 0.034, 0.035, 0.036, 0.033, 0.032, 0.031, 0.032, 0.033, 0.035, 0.034, 0.045 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" ... ========================= @@ -316,12 +316,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.148 ms the first time, including approximately 0.133 ms to tokenize the query. Subsequent executions are effectively free due to caching. +end for;" took 1.034 ms the first time, including approximately 0.155 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.043 +/- 0.014 ms over 40 trials -Query times (ms): 0.094, 0.045, 0.048, 0.106, 0.052, 0.053, 0.036, 0.036, 0.036, 0.045, 0.038, 0.05, 0.036, 0.038, 0.037, 0.038, 0.038, 0.036, 0.036, 0.035, 0.036, 0.037, 0.035, 0.037, 0.049, 0.037, 0.041, 0.039, 0.038, 0.038, 0.044, 0.045, 0.046, 0.036, 0.038, 0.038, 0.036, 0.041, 0.038, 0.04 +end for;" on JNode from JSON of size 89556 into took 0.067 +/- 0.133 ms over 40 trials +Query times (ms): 0.066, 0.039, 0.038, 0.037, 0.037, 0.037, 0.038, 0.036, 0.037, 0.037, 0.038, 0.043, 0.036, 0.036, 0.036, 0.038, 0.037, 0.037, 0.038, 0.041, 0.103, 0.081, 0.083, 0.096, 0.062, 0.042, 0.04, 0.037, 0.038, 0.037, 0.037, 0.892, 0.038, 0.036, 0.038, 0.068, 0.037, 0.033, 0.065, 0.054 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 ... ========================= @@ -330,18 +330,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 3.821 +/- 0.391 ms over 64 trials (minimal whitespace, sortKeys=TRUE) -To compress JNode from JSON string of 89556 took 2.314 +/- 0.716 ms over 64 trials (minimal whitespace, sortKeys=FALSE) -To Google-style pretty-print JNode from JSON string of 89556 took 4.703 +/- 1.093 ms over 64 trials (sortKeys=true, indent=4) -To Whitesmith-style pretty-print JNode from JSON string of 89556 took 4.894 +/- 0.778 ms over 64 trials (sortKeys=true, indent=4) -To PPrint-style pretty-print JNode from JSON string of 89556 took 5.984 +/- 0.634 ms over 64 trials (sortKeys=true, indent=4) +To compress JNode from JSON string of 89556 took 4.186 +/- 2.325 ms over 64 trials (minimal whitespace, sortKeys=TRUE) +To compress JNode from JSON string of 89556 took 2.126 +/- 0.757 ms over 64 trials (minimal whitespace, sortKeys=FALSE) +To Google-style pretty-print JNode from JSON string of 89556 took 4.387 +/- 0.395 ms over 64 trials (sortKeys=true, indent=4) +To Whitesmith-style pretty-print JNode from JSON string of 89556 took 5.41 +/- 1.234 ms over 64 trials (sortKeys=true, indent=4) +To PPrint-style pretty-print JNode from JSON string of 89556 took 6.052 +/- 0.413 ms over 64 trials (sortKeys=true, indent=4) ========================= Testing performance of JsonSchemaValidator and random JSON creation ========================= -To create a random set of tweet JSON of size 157017 (15 tweets) based on the matching schema took 6.469 +/- 2.916 ms over 64 trials -To compile the tweet schema to a validation function took 0.306 +/- 0.723 ms over 64 trials -To validate tweet JSON of size 157017 (15 tweets) based on the compiled schema took 1.012 +/- 0.208 ms over 64 trials +To create a random set of tweet JSON of size 156626 (15 tweets) based on the matching schema took 6.445 +/- 3.145 ms over 64 trials +To compile the tweet schema to a validation function took 0.522 +/- 1.502 ms over 64 trials +To validate tweet JSON of size 156626 (15 tweets) based on the compiled schema took 1.12 +/- 0.726 ms over 64 trials ========================= Testing JSON grepper's API request tool ========================= diff --git a/translation/italian.json5 b/translation/italian.json5 index cbcfbf1..b97d995 100644 --- a/translation/italian.json5 +++ b/translation/italian.json5 @@ -123,7 +123,7 @@ "titleIfParsing": "Analisi di JSON in corso", "titleIfReading": "Lettura dei file in corso", "captionIfParsing": "Lettura dei file completata.\r\nOra sta analizzando {0} documenti con una lunghezza complessiva di circa {1} MB", - "captionIfReading": "Ora sta leggendo {0} file con una lunghezza complessiva di cira {1} MB", + "captionIfReading": "Ora sta leggendo {0} file con una lunghezza complessiva di circa {1} MB", "progressLabelIfParsing": "0 MB di {0} MB analizzati", "progressLabelIfReading": "0 di {0} file letti" }