From 017c1ef5e0c8b22805bb96dc845185edb9ea0db4 Mon Sep 17 00:00:00 2001 From: Andriy Plokhotnyuk Date: Sun, 12 Jan 2025 11:54:54 +0100 Subject: [PATCH] Reduce memory footprint of `StringMatrix` --- .../shared/src/main/scala/zio/json/internal/lexer.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zio-json/shared/src/main/scala/zio/json/internal/lexer.scala b/zio-json/shared/src/main/scala/zio/json/internal/lexer.scala index f0a6ace3..738363d6 100644 --- a/zio-json/shared/src/main/scala/zio/json/internal/lexer.scala +++ b/zio-json/shared/src/main/scala/zio/json/internal/lexer.scala @@ -439,9 +439,9 @@ final class StringMatrix(val xs: Array[String], aliases: Array[(String, Int)] = } m } - private val resolve: Array[Int] = Array.tabulate[Int](width) { string => - if (string < xs.length) string - else aliases(string - xs.length)._2 + private val resolve: Array[Byte] = Array.tabulate[Byte](width) { string => + if (string < xs.length) string.toByte + else aliases(string - xs.length)._2.toByte } // must be called with increasing `char` (starting with bitset obtained from a