diff --git a/CHANGELOG.md b/CHANGELOG.md index 33b7e76..f39f4e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,7 +59,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed -1. If a [JSON lines document](/docs/README.md#json-lines-documents) is not compliant with the strict JSON specification, the [status bar](/docs/README.md#error-form-and-status-bar) will now reflect that it is JSON lines. +1. If a number string is too large or small for a 64-bit floating point number (for example, `-2e700`, `3.5e+450`), the JSON parser will now represent them as `-Infinity` (if they have a leading `-` sign) or `Infinity`, rather than representing them as `NaN`. The linter also has a new message for when this happens. +2. If a [JSON lines document](/docs/README.md#json-lines-documents) is not compliant with the strict JSON specification, the [status bar](/docs/README.md#error-form-and-status-bar) will now reflect that it is JSON lines. ### Fixed diff --git a/JsonToolsNppPlugin/Forms/TreeViewer.cs b/JsonToolsNppPlugin/Forms/TreeViewer.cs index f101015..c56bd14 100644 --- a/JsonToolsNppPlugin/Forms/TreeViewer.cs +++ b/JsonToolsNppPlugin/Forms/TreeViewer.cs @@ -1479,18 +1479,19 @@ public void Rename(string newFname, bool isFilename) /// /// sets this.ptrTitleBuf to a pointer to an unmanaged Unicode char array containing the title of this TreeViewer's docking form.

- /// If isFilename, strips the directory name away from the beginning of title. + /// If isFilename, inserts the title (after stripping the directory name away from the beginning of title) into the normal format string for the TreeViewer title ///
public IntPtr SetTitleBuffer(string title, bool isFilename) { + string fullTitle = title; if (isFilename) { string[] fnameSplit = fname.Split('\\'); title = fnameSplit[fnameSplit.Length - 1]; + string defaultNameFormat = "Json Tree View for {0}"; + string nameFormat = (Translator.TryGetTranslationAtPath(new string[] { "forms", "TreeViewer", "title" }, out JNode node) && node.value is string s && s.Contains("{0}")) ? s : defaultNameFormat; + fullTitle = nameFormat.Replace("{0}", title); } - string defaultNameFormat = "Json Tree View for {0}"; - string nameFormat = (Translator.TryGetTranslationAtPath(new string[] { "forms", "TreeViewer", "title" }, out JNode node) && node.value is string s && s.Contains("{0}")) ? s : defaultNameFormat; - string fullTitle = nameFormat.Replace("{0}", title); int maxCharsTitleBuf = MAX_LEN_TITLE_BUFFER / Marshal.SystemDefaultCharSize - 1; if (fullTitle.Length > maxCharsTitleBuf) fullTitle = fullTitle.Substring(0, maxCharsTitleBuf - 3) + "..."; diff --git a/JsonToolsNppPlugin/JSONTools/JsonParser.cs b/JsonToolsNppPlugin/JSONTools/JsonParser.cs index acfb48b..6ce5d5f 100644 --- a/JsonToolsNppPlugin/JSONTools/JsonParser.cs +++ b/JsonToolsNppPlugin/JSONTools/JsonParser.cs @@ -187,6 +187,7 @@ public string TranslateMessageIfDesired(bool translated) case JsonLintType.BAD_PYTHON_False: return Translator.TranslateLintMessage(translated, lintType, "False is not allowed in any JSON specification"); case JsonLintType.BAD_JAVASCRIPT_undefined: return Translator.TranslateLintMessage(translated, lintType, "undefined is not allowed in any JSON specification"); case JsonLintType.BAD_CHAR_INSTEAD_OF_EOF: return TryTranslateWithOneParam(translated, lintType, "At end of valid JSON document, got {0} instead of EOF", param1); + case JsonLintType.BAD_FLOAT_TOO_LARGE: return TryTranslateWithOneParam(translated, lintType, "Number string {0} is too large for a 64-bit floating point number", param1); // FATAL messages case JsonLintType.FATAL_EXPECTED_JAVASCRIPT_COMMENT: return Translator.TranslateLintMessage(translated, lintType, "Expected JavaScript comment after '/'"); case JsonLintType.FATAL_HEXADECIMAL_TOO_SHORT: return TryTranslateWithOneParam(translated, lintType, "Could not find valid hexadecimal of length {0}", param1); @@ -355,6 +356,10 @@ public enum JsonLintType : short /// param1 = c (char) /// BAD_CHAR_INSTEAD_OF_EOF = BAD_UNTERMINATED_MULTILINE_COMMENT + 31, + /// + /// param1 = numStr (string) + /// + BAD_FLOAT_TOO_LARGE = BAD_UNTERMINATED_MULTILINE_COMMENT + 32, // ========== FATAL errors ============= FATAL_EXPECTED_JAVASCRIPT_COMMENT = (ParserState.FATAL - 1) << 10, /// @@ -1357,10 +1362,17 @@ public JNode ParseNumber(string inp) { num = double.Parse(numstr, JNode.DOT_DECIMAL_SEP); } - catch + catch (Exception ex) { - HandleError(JsonLintType.BAD_NUMBER_INVALID_FORMAT, inp, startUtf8Pos, JNode.StrToString(numstr, true)); - num = NanInf.nan; + var errno = JsonLintType.BAD_NUMBER_INVALID_FORMAT; + if (ex is OverflowException) + { + num = negative ? NanInf.neginf : NanInf.inf; + errno = JsonLintType.BAD_FLOAT_TOO_LARGE; + } + else + num = NanInf.nan; + HandleError(errno, inp, startUtf8Pos, JNode.StrToString(numstr, true)); } if (numstr[numstr.Length - 1] == '.') HandleError(JsonLintType.JSON5_NUM_TRAILING_DECIMAL_POINT, inp, startUtf8Pos); diff --git a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs index ad499da..c803f3e 100644 --- a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs +++ b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("8.1.0.6")] -[assembly: AssemblyFileVersion("8.1.0.6")] +[assembly: AssemblyVersion("8.1.0.7")] +[assembly: AssemblyFileVersion("8.1.0.7")] diff --git a/JsonToolsNppPlugin/Tests/JsonParserTests.cs b/JsonToolsNppPlugin/Tests/JsonParserTests.cs index ccefcbb..dd6eac9 100644 --- a/JsonToolsNppPlugin/Tests/JsonParserTests.cs +++ b/JsonToolsNppPlugin/Tests/JsonParserTests.cs @@ -639,7 +639,10 @@ instead got new object[] { "{}", "{" + NL + " }", true }, new object[] { "[]", "[ ]", true }, new object[] { "[]", "[1, 2]", false }, - new object[] { "1" + new string('0', 400), "NaN", true }, // really really big int representations + new object[] { "1" + new string('0', 400), "Infinity", true }, // really really big int representations + new object[] { "-2" + new string('3', 350), "-Infinity", true }, // really really big int representations (negative) + new object[] { "-2.1234567890e700", "-Infinity", true }, // really really big float representations (negative) + new object[] { "5.43433666464342343433341e4550", "Infinity", true }, // really really big float representations (positive) }; foreach (object[] test in equalityTestcases) { @@ -1083,6 +1086,14 @@ public static bool TestLinter() "Numbers with an unnecessary leading 0 (like \"01\") are not allowed in any JSON specification", "Numbers with an unnecessary leading 0 (like \"01\") are not allowed in any JSON specification", }), + ("[9.7642E+857, -23e500, 3e-, +" + new string('3', 400) + "]", "[Infinity, -Infinity, NaN, Infinity]", new string[] + { + "Number string \"9.7642E+857\" is too large for a 64-bit floating point number", + "Number string \"-23e500\" is too large for a 64-bit floating point number", + "Number string \"3e-\" had bad format", + "Leading + signs in numbers are only allowed in JSON5", + "Number string \"+" + new string('3', 400) + "\" is too large for a 64-bit floating point number", + }), }; int testsFailed = 0; diff --git a/most recent errors.txt b/most recent errors.txt index fbf4194..f327129 100644 --- a/most recent errors.txt +++ b/most recent errors.txt @@ -1,4 +1,4 @@ -Test results for JsonTools v8.1.0.6 on Notepad++ 8.6.9 64bit +Test results for JsonTools v8.1.0.7 on Notepad++ 8.7.0 64bit NOTE: Ctrl-F (regular expressions *on*) for "Failed [1-9]\d*" to find all failed tests Tests failed: YAML dumper ========================= @@ -22,7 +22,7 @@ obj = zuq*/ Failed 0 tests. -Passed 142 tests. +Passed 145 tests. ========================= Testing if JSON parser throws errors on bad inputs ========================= @@ -40,7 +40,7 @@ Testing JSON parser's linter ========================= Failed 0 tests. -Passed 71 tests. +Passed 72 tests. ========================= Testing JSON Lines parser ========================= @@ -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 3.455 +/- 2.235 ms over 32 trials -Load times (ms): 2, 2, 5, 1, 2, 6, 1, 1, 1, 5, 2, 2, 9, 2, 2, 2, 6, 2, 2, 8, 2, 2, 2, 6, 2, 2, 8, 2, 2, 2, 6, 2 +To convert JSON string of size 89556 into JNode took 2.906 +/- 1.981 ms over 32 trials +Load times (ms): 2, 2, 5, 1, 1, 6, 2, 1, 1, 4, 1, 2, 7, 1, 1, 1, 5, 1, 1, 6, 1, 1, 2, 7, 1, 1, 1, 4, 1, 1, 5, 1 ========================= Performance tests for RemesPath (float arithmetic) ========================= -Compiling query "@[@[:].a * @[:].t < @[:].e]" took 0.088 ms the first time, including approximately 0.091 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.039 +/- 0.009 ms over 40 trials -Query times (ms): 0.089, 0.053, 0.038, 0.036, 0.04, 0.036, 0.036, 0.045, 0.037, 0.038, 0.036, 0.036, 0.036, 0.04, 0.036, 0.036, 0.036, 0.036, 0.036, 0.039, 0.036, 0.036, 0.036, 0.037, 0.036, 0.038, 0.036, 0.037, 0.036, 0.036, 0.035, 0.04, 0.036, 0.036, 0.036, 0.035, 0.036, 0.039, 0.037, 0.037 +Compiling query "@[@[:].a * @[:].t < @[:].e]" took 0.094 ms the first time, including approximately 0.111 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.028 +/- 0.015 ms over 40 trials +Query times (ms): 0.083, 0.037, 0.023, 0.041, 0.023, 0.022, 0.022, 0.031, 0.022, 0.022, 0.022, 0.022, 0.022, 0.026, 0.023, 0.023, 0.022, 0.022, 0.022, 0.027, 0.022, 0.023, 0.023, 0.029, 0.022, 0.026, 0.023, 0.022, 0.023, 0.022, 0.022, 0.025, 0.022, 0.022, 0.023, 0.022, 0.022, 0.092, 0.037, 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" ... ========================= Performance tests for RemesPath (string operations) ========================= -Compiling query "@[@[:].z =~ `(?i)[a-z]{5}`]" took 0.039 ms the first time, including approximately 0.043 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.154 +/- 0.611 ms over 40 trials -Query times (ms): 0.108, 0.057, 0.056, 0.067, 0.082, 0.055, 0.053, 0.054, 0.054, 0.054, 0.054, 0.054, 0.053, 0.054, 0.053, 0.054, 0.053, 0.054, 0.053, 0.053, 3.969, 0.068, 0.053, 0.054, 0.052, 0.053, 0.053, 0.053, 0.052, 0.051, 0.053, 0.052, 0.052, 0.052, 0.051, 0.052, 0.053, 0.052, 0.052, 0.052 +Compiling query "@[@[:].z =~ `(?i)[a-z]{5}`]" took 0.04 ms the first time, including approximately 0.042 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.14 +/- 0.513 ms over 40 trials +Query times (ms): 0.102, 0.058, 0.064, 0.067, 0.089, 0.054, 0.054, 0.055, 0.054, 0.054, 0.053, 0.054, 0.053, 0.054, 0.053, 0.054, 0.054, 0.054, 0.053, 0.06, 0.054, 0.06, 0.055, 0.053, 0.054, 0.054, 0.054, 0.054, 0.054, 0.053, 3.345, 0.057, 0.07, 0.066, 0.053, 0.052, 0.052, 0.052, 0.052, 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.258 ms the first time, including approximately 0.246 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.207 ms the first time, including approximately 0.383 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.038 +/- 0.077 ms over 40 trials -Query times (ms): 0.07, 0.025, 0.026, 0.024, 0.024, 0.024, 0.519, 0.03, 0.024, 0.024, 0.025, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.024, 0.023, 0.024, 0.023, 0.024, 0.024, 0.024, 0.024, 0.024, 0.023, 0.023 +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.01 ms over 40 trials +Query times (ms): 0.078, 0.019, 0.016, 0.016, 0.015, 0.016, 0.015, 0.015, 0.016, 0.015, 0.015, 0.015, 0.016, 0.016, 0.015, 0.015, 0.015, 0.015, 0.015, 0.016, 0.016, 0.015, 0.021, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.016, 0.015, 0.015, 0.015, 0.016, 0.015, 0.015, 0.015, 0.015 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.121 ms the first time, including approximately 0.112 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.136 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.025 +/- 0.008 ms over 40 trials -Query times (ms): 0.046, 0.026, 0.02, 0.021, 0.022, 0.021, 0.022, 0.056, 0.022, 0.022, 0.025, 0.034, 0.023, 0.034, 0.022, 0.02, 0.021, 0.024, 0.022, 0.024, 0.022, 0.036, 0.022, 0.048, 0.02, 0.021, 0.02, 0.022, 0.021, 0.021, 0.02, 0.021, 0.021, 0.022, 0.02, 0.02, 0.021, 0.021, 0.021, 0.02 +@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.015 +/- 0.008 ms over 40 trials +Query times (ms): 0.059, 0.013, 0.021, 0.012, 0.012, 0.012, 0.012, 0.012, 0.012, 0.013, 0.014, 0.012, 0.012, 0.013, 0.018, 0.029, 0.012, 0.013, 0.012, 0.032, 0.019, 0.012, 0.012, 0.012, 0.012, 0.012, 0.013, 0.012, 0.012, 0.013, 0.012, 0.013, 0.012, 0.012, 0.012, 0.012, 0.012, 0.012, 0.012, 0.012 Preview of result: [[1695727848, 0.28756263873668497], [2126430375, 0.0076779412970817704], [5310550656, 0.38076977264568701], [2519183283, 0.15317622093055799], [6610062385, 0.66299622587066598], [987168256, 0.92441018999992797], [6615003609, 0.91711269122594696], [4465232046, 0.68431193185153605], [8654414565, 0.631 ... ========================= @@ -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.09 ms the first time, including approximately 0.087 ms to tokenize the query. Subsequent executions are effectively free due to caching. +@[:]->at(@, X)->at(@, onetwo)" took 0.084 ms the first time, including approximately 0.125 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.016 +/- 0.004 ms over 40 trials -Query times (ms): 0.043, 0.016, 0.015, 0.015, 0.015, 0.015, 0.016, 0.016, 0.016, 0.015, 0.016, 0.015, 0.015, 0.015, 0.016, 0.015, 0.016, 0.016, 0.016, 0.016, 0.016, 0.015, 0.016, 0.016, 0.016, 0.016, 0.015, 0.016, 0.016, 0.016, 0.015, 0.016, 0.016, 0.015, 0.015, 0.016, 0.015, 0.016, 0.016, 0.015 +@[:]->at(@, X)->at(@, onetwo)" on JNode from JSON of size 89556 into took 0.026 +/- 0.054 ms over 40 trials +Query times (ms): 0.056, 0.016, 0.016, 0.016, 0.015, 0.016, 0.016, 0.015, 0.016, 0.016, 0.015, 0.016, 0.016, 0.015, 0.016, 0.022, 0.018, 0.02, 0.359, 0.025, 0.016, 0.015, 0.015, 0.016, 0.015, 0.023, 0.016, 0.016, 0.015, 0.016, 0.015, 0.015, 0.016, 0.015, 0.015, 0.016, 0.015, 0.015, 0.016, 0.016 Preview of result: [[1695727848, 0.28756263873668497], [2126430375, 0.0076779412970817704], [5310550656, 0.38076977264568701], [2519183283, 0.15317622093055799], [6610062385, 0.66299622587066598], [987168256, 0.92441018999992797], [6615003609, 0.91711269122594696], [4465232046, 0.68431193185153605], [8654414565, 0.631 ... ========================= Performance tests for RemesPath (simple string mutations) ========================= -Compiling query "@[:].z = s_sub(@, g, B)" took 0.053 ms the first time, including approximately 0.594 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.019 +/- 0.009 ms over 40 trials -Query times (ms): 0.04, 0.017, 0.016, 0.024, 0.036, 0.027, 0.04, 0.024, 0.026, 0.025, 0.025, 0.025, 0.03, 0.027, 0.025, 0.025, 0.026, 0.026, 0.023, 0.011, 0.011, 0.01, 0.013, 0.011, 0.01, 0.016, 0.011, 0.01, 0.011, 0.01, 0.011, 0.016, 0.012, 0.012, 0.012, 0.011, 0.012, 0.011, 0.01, 0.028 +Compiling query "@[:].z = s_sub(@, g, B)" took 0.048 ms the first time, including approximately 0.048 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.018 +/- 0.01 ms over 40 trials +Query times (ms): 0.076, 0.014, 0.011, 0.024, 0.014, 0.014, 0.014, 0.013, 0.017, 0.014, 0.013, 0.015, 0.014, 0.017, 0.016, 0.024, 0.026, 0.033, 0.02, 0.018, 0.016, 0.017, 0.017, 0.016, 0.017, 0.017, 0.018, 0.021, 0.016, 0.019, 0.016, 0.021, 0.012, 0.011, 0.013, 0.012, 0.011, 0.012, 0.011, 0.011 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.061 ms the first time, including approximately 0.062 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.022 +/- 0.01 ms over 40 trials -Query times (ms): 0.035, 0.029, 0.026, 0.026, 0.021, 0.051, 0.063, 0.028, 0.019, 0.017, 0.017, 0.018, 0.018, 0.017, 0.026, 0.022, 0.042, 0.023, 0.017, 0.017, 0.018, 0.018, 0.018, 0.018, 0.017, 0.018, 0.017, 0.018, 0.016, 0.023, 0.024, 0.018, 0.017, 0.017, 0.018, 0.018, 0.018, 0.017, 0.017, 0.018 +Compiling query "@[:].x = ifelse(@ < 0.5, @ + 3, @ - 3)" took 0.075 ms the first time, including approximately 0.074 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.041 +/- 0.046 ms over 40 trials +Query times (ms): 0.039, 0.029, 0.026, 0.027, 0.019, 0.017, 0.02, 0.019, 0.017, 0.018, 0.038, 0.025, 0.02, 0.044, 0.036, 0.055, 0.056, 0.041, 0.022, 0.02, 0.037, 0.033, 0.038, 0.035, 0.031, 0.032, 0.035, 0.071, 0.057, 0.315, 0.034, 0.041, 0.036, 0.035, 0.027, 0.026, 0.028, 0.062, 0.037, 0.032 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.28 ms the first time, including approximately 0.146 ms to tokenize the query. Subsequent executions are effectively free due to caching. +end for;" took 0.276 ms the first time, including approximately 0.197 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.066 +/- 0.15 ms over 40 trials -Query times (ms): 0.075, 0.999, 0.039, 0.037, 0.036, 0.037, 0.037, 0.038, 0.038, 0.038, 0.037, 0.037, 0.037, 0.038, 0.044, 0.036, 0.037, 0.037, 0.038, 0.038, 0.037, 0.037, 0.037, 0.036, 0.036, 0.038, 0.049, 0.044, 0.036, 0.037, 0.037, 0.039, 0.034, 0.034, 0.033, 0.048, 0.051, 0.051, 0.051, 0.106 +end for;" on JNode from JSON of size 89556 into took 0.083 +/- 0.144 ms over 40 trials +Query times (ms): 0.082, 0.056, 0.04, 0.04, 0.038, 0.037, 0.038, 0.093, 0.071, 0.071, 0.069, 0.04, 0.039, 0.04, 0.064, 0.072, 0.064, 0.052, 0.039, 0.076, 0.076, 0.071, 0.072, 0.073, 0.066, 0.099, 0.087, 0.141, 0.09, 0.968, 0.048, 0.038, 0.038, 0.038, 0.056, 0.036, 0.04, 0.039, 0.038, 0.07 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,32 +330,32 @@ 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 5.241 +/- 0.916 ms over 64 trials (minimal whitespace, sortKeys=TRUE) -To compress JNode from JSON string of 89556 took 2.923 +/- 0.596 ms over 64 trials (minimal whitespace, sortKeys=FALSE) -To Google-style pretty-print JNode from JSON string of 89556 took 5.524 +/- 1.194 ms over 64 trials (sortKeys=true, indent=4) -To Whitesmith-style pretty-print JNode from JSON string of 89556 took 5.111 +/- 1.263 ms over 64 trials (sortKeys=true, indent=4) -To PPrint-style pretty-print JNode from JSON string of 89556 took 7.224 +/- 1.639 ms over 64 trials (sortKeys=true, indent=4) +To compress JNode from JSON string of 89556 took 4.493 +/- 0.854 ms over 64 trials (minimal whitespace, sortKeys=TRUE) +To compress JNode from JSON string of 89556 took 2.225 +/- 0.457 ms over 64 trials (minimal whitespace, sortKeys=FALSE) +To Google-style pretty-print JNode from JSON string of 89556 took 4.619 +/- 0.856 ms over 64 trials (sortKeys=true, indent=4) +To Whitesmith-style pretty-print JNode from JSON string of 89556 took 5.027 +/- 1.06 ms over 64 trials (sortKeys=true, indent=4) +To PPrint-style pretty-print JNode from JSON string of 89556 took 7.612 +/- 1.818 ms over 64 trials (sortKeys=true, indent=4) ========================= Testing performance of JsonSchemaValidator and random JSON creation ========================= -To create a random set of JSON from file at path C:\Program Files\Notepad++\plugins\JsonTools\testfiles\tweet_schema.json of size 166201 (array of 15 items) based on the matching schema took 7.715 +/- 3.929 ms over 25 trials -To compile the schema to a validation function took 0.252 +/- 0.059 ms over 25 trials -To validate JSON of size 166201 (array of 15 items) based on the compiled schema took 1.202 +/- 0.278 ms over 25 trials +To create a random set of JSON from file at path C:\Program Files\Notepad++\plugins\JsonTools\testfiles\tweet_schema.json of size 174722 (array of 15 items) based on the matching schema took 7.692 +/- 3.885 ms over 25 trials +To compile the schema to a validation function took 0.431 +/- 0.82 ms over 25 trials +To validate JSON of size 174722 (array of 15 items) based on the compiled schema took 1.21 +/- 0.285 ms over 25 trials ========================= Testing performance of random JSON from schema with patterns and patternProperties ========================= -To create a random set of JSON from string (see TestRunner.cs) of size 29770 (array of 120 items) based on the matching schema took 1.714 +/- 1.01 ms over 25 trials -To compile the schema to a validation function took 0.267 +/- 0.039 ms over 25 trials -To validate JSON of size 29770 (array of 120 items) based on the compiled schema took 9.481 +/- 1.057 ms over 25 trials +To create a random set of JSON from string (see TestRunner.cs) of size 30036 (array of 120 items) based on the matching schema took 1.796 +/- 0.904 ms over 25 trials +To compile the schema to a validation function took 0.376 +/- 0.39 ms over 25 trials +To validate JSON of size 30036 (array of 120 items) based on the compiled schema took 10.531 +/- 1.17 ms over 25 trials ========================= Testing performance of random JSON from schema *ignoring* patterns and patternProperties ========================= -To create a random set of JSON from string (see TestRunner.cs) of size 11379 (array of 120 items) based on the matching schema took 0.828 +/- 0.353 ms over 25 trials -To compile the schema to a validation function took 0.232 +/- 0.036 ms over 25 trials -To validate JSON of size 11379 (array of 120 items) based on the compiled schema took 5.888 +/- 0.909 ms over 25 trials +To create a random set of JSON from string (see TestRunner.cs) of size 11114 (array of 120 items) based on the matching schema took 1.125 +/- 0.945 ms over 25 trials +To compile the schema to a validation function took 0.34 +/- 0.408 ms over 25 trials +To validate JSON of size 11114 (array of 120 items) based on the compiled schema took 6.235 +/- 0.619 ms over 25 trials ========================= Testing JSON grepper's API request tool ========================= diff --git a/translation/english.json5 b/translation/english.json5 index 96e9551..220411b 100644 --- a/translation/english.json5 +++ b/translation/english.json5 @@ -352,6 +352,7 @@ "BAD_PYTHON_False": "False is not allowed in any JSON specification", "BAD_JAVASCRIPT_undefined": "undefined is not allowed in any JSON specification", "BAD_CHAR_INSTEAD_OF_EOF": "At end of valid JSON document, got {0} instead of EOF", + "BAD_FLOAT_TOO_LARGE": "Number string {0} is too large for a 64-bit floating point number", // ============== FATAL messages ============== "FATAL_EXPECTED_JAVASCRIPT_COMMENT": "Expected JavaScript comment after '/'", "FATAL_HEXADECIMAL_TOO_SHORT": "Could not find valid hexadecimal of length {0}", diff --git a/translation/italian.json5 b/translation/italian.json5 index 89ae3ba..958cef3 100644 --- a/translation/italian.json5 +++ b/translation/italian.json5 @@ -361,6 +361,7 @@ "BAD_PYTHON_False": "False non è previsto in nessuna specifica JSON", "BAD_JAVASCRIPT_undefined": "undefined non è previsto in nessuna specifica JSON", "BAD_CHAR_INSTEAD_OF_EOF": "Alla fine del documento JSON valido, ho ricevuto {0} invece di EOF", + "BAD_FLOAT_TOO_LARGE": "La stringa numerica {0} è troppo grande per un numero in virgola mobile a 64 bit", // ============== FATAL messages ============== "FATAL_EXPECTED_JAVASCRIPT_COMMENT": "Previsto commento JavaScript dopo '/'", "FATAL_HEXADECIMAL_TOO_SHORT": "Impossibile trovare un esadecimale valido di lunghezza {0}",