FasterXML / FasterXML/jackson-core

Investigate use of Compact strings for `TextBuffer`

未关闭
#910 10 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
2.4k
派生
928
平均合并
2 天 18 小时
30 天内合并 PR
24

描述

I was looking at some heap dumps and saw that TextBuffer still uses char[] internally. I think it could instead use an approach similar to the jdk String and StringBuilder, with a byte[] that either contains latin1 encoded as one byte per char, or utf-16 with two bytes per char. This would save a lot of memory in most standard cases, especially when the buffer becomes large.

It could also improve performance when constructing String instances a bit. Using the String charset constructor, it's possible to create a latin1 String directly from bytes with a single copy, while going through the char[] constructor needs to run compaction. I don't know if this is relevant though, the compaction is probably already very fast.

What do you think @cowtowncoder @pjfanning ?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。