From 3939991e76c4118e220ba2cad9fc614005f469cc Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 18 Mar 2023 07:11:55 +0800 Subject: [PATCH] fixtests --- bench/src-jvm/Main.scala | 56 ++++++++++++------------- core/src/upickle/core/RenderUtils.scala | 4 +- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/bench/src-jvm/Main.scala b/bench/src-jvm/Main.scala index 30d2d35a4..d35ecd036 100644 --- a/bench/src-jvm/Main.scala +++ b/bench/src-jvm/Main.scala @@ -33,8 +33,8 @@ object Main{ val results = Seq( Common.upickleDefault(duration), - Common.upickleDefaultByteArray(duration), - Common.upickleDefaultBinary(duration), +// Common.upickleDefaultByteArray(duration), +// Common.upickleDefaultBinary(duration), // Common.upickleLegacy(duration) // Common.upickleBinaryLegacy(duration) // Common.genCodec(duration) @@ -55,32 +55,32 @@ object Main{ // benchParsingRendering(duration, bytes = false, strings = false, streams = true, msgpack = false) // benchParsingRendering(duration, bytes = false, strings = false, streams = false, msgpack = true) Common.integers(duration), - Common.integersByteArray(duration), - Common.integersBinary(duration), - - Common.doubles(duration), - Common.doublesByteArray(duration), - Common.doublesBinary(duration), - - Common.sequences(duration), - Common.sequencesByteArray(duration), - Common.sequencesBinary(duration), - - Common.shortStrings(duration), - Common.shortStringsByteArray(duration), - Common.shortStringsBinary(duration), - - Common.longStrings(duration), - Common.longStringsByteArray(duration), - Common.longStringsBinary(duration), - - Common.unicodeStrings(duration), - Common.unicodeStringsByteArray(duration), - Common.unicodeStringsBinary(duration), - - Common.caseClasses(duration), - Common.caseClassesByteArray(duration), - Common.caseClassesBinary(duration) +// Common.integersByteArray(duration), +// Common.integersBinary(duration), + +// Common.doubles(duration), +// Common.doublesByteArray(duration), +// Common.doublesBinary(duration), +// +// Common.sequences(duration), +// Common.sequencesByteArray(duration), +// Common.sequencesBinary(duration), +// +// Common.shortStrings(duration), +// Common.shortStringsByteArray(duration), +// Common.shortStringsBinary(duration), +// +// Common.longStrings(duration), +// Common.longStringsByteArray(duration), +// Common.longStringsBinary(duration), +// +// Common.unicodeStrings(duration), +// Common.unicodeStringsByteArray(duration), +// Common.unicodeStringsBinary(duration), +// +// Common.caseClasses(duration), +// Common.caseClassesByteArray(duration), +// Common.caseClassesBinary(duration) ) if (save) allResults.appendAll(results.flatten) diff --git a/core/src/upickle/core/RenderUtils.scala b/core/src/upickle/core/RenderUtils.scala index dabcb2920..46f68f191 100644 --- a/core/src/upickle/core/RenderUtils.scala +++ b/core/src/upickle/core/RenderUtils.scala @@ -216,9 +216,11 @@ object RenderUtils{ x = -x } var p: Long = -10 - for (i <- 1 until 19) { + var i = 1 + while (i <= 18){ if (x > p) return i + d p = 10 * p + i += 1 } 19 + d }