Skip to content

Commit

Permalink
Reduce memory footprint of StringMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Jan 12, 2025
1 parent 6d18b71 commit 99fd832
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zio-json/shared/src/main/scala/zio/json/internal/lexer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ final class StringMatrix(val xs: Array[String], aliases: Array[(String, Int)] =
val lengths: Array[Int] = xs.map(_.length) ++ aliases.map(_._1.length)
val initial: Long = (0 until width).foldLeft(0L)((bs, r) => bs | (1L << r))

private val matrix: Array[Int] = {
val m = Array.fill[Int](width * height)(-1)
private val matrix: Array[Char] = {
val m = Array.fill[Char](width * height)(0xFFFF)
var string: Int = 0
while (string < width) {
val s = if (string < xs.length) xs(string) else aliases(string - xs.length)._1
Expand Down

0 comments on commit 99fd832

Please sign in to comment.