Skip to content

Commit

Permalink
Release v8.2
Browse files Browse the repository at this point in the history
Also make round-trip failure not exit double array dump/parse benchmark early
  • Loading branch information
molsonkiko committed Nov 10, 2024
1 parent a7fef1c commit dfd63ea
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Change Log
All [notable changes](#810---2024-08-23) to this project will be documented in this file.
All [notable changes](#820---2024-11-09) to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
Expand Down Expand Up @@ -51,7 +51,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Since v7.0, holding down `Enter` in a multiline textbox (like the [tree viewer query box](/docs/README.md#remespath)) only adds one newline when the key is lifted.
- Maybe use pre-7.1 (dictionary-based rather than indicator-based) [selection remembering](/docs/README.md#working-with-selections) for Notepad++ 8.5.5 and earlier? Indicators are risky with those older NPP's because of the lack of `NPPM_ALLOCATEINDICATOR`.

## [8.2.0] - (UNRELEASED) YYYY-MM-DD
## [8.2.0] - 2024-11-09

### Added

Expand All @@ -66,7 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

1. Fix issue (introduced in v8.1, see issues [83](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/83) and [81](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/81)) where decimal numbers were given unnecessarily precise string representations. __For example, in JsonTools v8.1, `11.11` would be represented as `11.109999999999999` even though the original `11.11` was an equally valid representation.__ Now all decimal numbers will be given the more compact representation used in v8.0 and earlier *unless the more verbose representation introduced in v8.1 would be necessary to avoid loss of precision* (so there will be no regression on [issue 78](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/78)). Note that __this new algorithm for formatting decimal numbers is about twice as slow as the algorithm used in v8.1__, although the impact on performance will be much less dramatic unless you are compressing an array where almost every element is a non-integer decimal number.
1. Fix issue (introduced in v8.1, see issues [83](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/83) and [81](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/81)) where decimal numbers were given unnecessarily precise string representations. __For example, in JsonTools v8.1, `11.11` would be represented as `11.109999999999999` even though the original `11.11` was an equally valid representation.__ Now all decimal numbers will be given the more compact representation used in v8.0 and earlier *unless the more verbose representation introduced in v8.1 would be necessary to avoid loss of precision* (so there will be no regression on [issue 78](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/78)). Note that __this new algorithm for formatting decimal numbers is about twice as slow as the algorithm used in v8.1__ (for 64-bit JsonTools; 32-bit has no performance loss), although the impact on performance will be much less dramatic unless you are compressing an array where almost every element is a non-integer decimal number.
1. Fix the following issues with [random string from regex](/docs/README.md#random-strings-from-regex-added-in-v81):
- It previously incorrectly flagged some valid regular expressions (e.g. `(?-i)(?:xy{1,2}){,2}`) as having two consecutive quantifiers.
- It previously did not correctly handle some character sets where the final character was `-` (for example, `[+-]` previously would only generate `+`, and now it correctly has a 50% chance of generating `-` or `+`)
Expand Down
4 changes: 2 additions & 2 deletions JsonToolsNppPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("8.1.0.16")]
[assembly: AssemblyFileVersion("8.1.0.16")]
[assembly: AssemblyVersion("8.2.0.0")]
[assembly: AssemblyFileVersion("8.2.0.0")]
Binary file modified JsonToolsNppPlugin/Release_x64.zip
Binary file not shown.
Binary file modified JsonToolsNppPlugin/Release_x86.zip
Binary file not shown.
12 changes: 6 additions & 6 deletions JsonToolsNppPlugin/Tests/Benchmarker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public static bool BenchmarkAndFuzzParseAndFormatDoubles(int numTrials, int arra
string numArrPreview = "";
string numArrayStr = "";
string numArrayDumped = "";
var badValues = new List<double>();
for (int ii = 0; ii < numTrials; ii++)
{
try
Expand Down Expand Up @@ -235,19 +236,13 @@ public static bool BenchmarkAndFuzzParseAndFormatDoubles(int numTrials, int arra
{
// verify that all doubles in numArray round-trip to the same value when parsing numArrayDumped
JArray numArrayFromDumped = (JArray)parser.Parse(numArrayDumped);
var badValues = new List<double>();
for (int jj = 0; jj < numArray.Length; jj++)
{
double val = (double)numArray[jj].value;
double reloaded = (double)numArrayFromDumped[jj].value;
if (val != reloaded)
badValues.Add(val);
}
if (badValues.Count > 0)
{
Npp.AddLine($"The following doubles did not round-trip:\r\n" + string.Join(", ", badValues.Select(x => x.ToString(JNode.DOT_DECIMAL_SEP))));
return true;
}
}
catch (Exception ex)
{
Expand All @@ -266,6 +261,11 @@ public static bool BenchmarkAndFuzzParseAndFormatDoubles(int numTrials, int arra
var dumpTimesStr = ticksToDump.Select(x => (x / 10_000).ToString()).ToArray();
Npp.AddLine($"Times to re-compress (ms): {string.Join(", ", dumpTimesStr)}");
string numArrayDumpedPreview = numArrayDumped.Length <= 200 ? numArrayDumped : numArrayDumped.Substring(0, 200) + "...";
if (badValues.Count > 0)
{
Npp.AddLine($"The following doubles did not round-trip:\r\n" + string.Join(", ", badValues.Select(x => x.ToString(JNode.DOT_DECIMAL_SEP))));
return true;
}
Npp.AddLine($"Representative example of result of re-compression = \"{numArrayDumpedPreview}\"");
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ Of course, there's also the default sort, which can only compare numbers to numb

See the [general notes on string sorting](/README.md#note-on-how-jsontools-sorts-strings) for more notes on how strings are sorted.

For versions of JsonTools [v8.2](/CHANGELOG.md#820---unreleased-yyyy-mm-dd) and newer, [JSON Lines](#json-lines-documents) documents remain formatted as JSON Lines after sorting by the sort form. Earlier versions of JsonTools pretty-printed all JSON after sorting, including JSON Lines.
For versions of JsonTools [v8.2](/CHANGELOG.md#820---2024-11-09) and newer, [JSON Lines](#json-lines-documents) documents remain formatted as JSON Lines after sorting by the sort form. Earlier versions of JsonTools pretty-printed all JSON after sorting, including JSON Lines.

## Regex search form ##

Expand Down
2 changes: 1 addition & 1 deletion docs/RemesPath.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ Random number between 0 (inclusive) and 1 (exclusive). *Added in [v5.2](/CHANGEL
---
`rand_schema(schema: object, minArrayLength: int = 0, maxArrayLength: int = 10, extendedAsciiStrings: bool = false, usePatterns: bool = false)`

*Added in [v8.2](/CHANGELOG.md#820---unreleased-yyyy-mm-dd)*
*Added in [v8.2](/CHANGELOG.md#820---2024-11-09)*

Creates [random JSON from `schema`](/docs/README.md#generating-random-json-from-a-schema), where the four optional arguments take the place of the global settings `minArrayLength`, `maxArrayLength`, `extended_ascii_strings`, and `generate_random_patterns`, respectively.

Expand Down
Loading

0 comments on commit dfd63ea

Please sign in to comment.