Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 13, 2025

Bumps com.alibaba.fastjson2:fastjson2 from 2.0.53 to 2.0.54.

Release notes

Sourced from com.alibaba.fastjson2:fastjson2's releases.

fastjson 2.0.54版本发布,性能进一步提升

这又是一个性能优化Bug修复的版本更新版本,大家按需升级。

1. 性能优化

这个版本的性能优化包括:

1.1 使用SWAR(SIMD Within A Register)技巧来优化序列化字符串的性能

序列化时,写字符串检测是否存在特别字符是一个性能关键点,这个版本使用SWAR(SIMD Within A Register)的技巧来做快速检测。如下

package com.alibaba.fastjson2;
class JSONWriterUTF8 {
    protected final long byteVectorQuote;
JSONWriterUTF8(Context ctx) {
// " -> 0x22, ' -> 0x27
this.byteVectorQuote = this.useSingleQuote ? 0x2727_2727_2727_2727L : 0x2222_2222_2222_2222L;
}
public void writeStringLatin1(byte[] value) {
    final long vecQuote = this.byteVectorQuote;
    int i = 0;
    final int upperBound = (value.length - i) & ~7;
    // 这里一次检测8个byte是否存在特别字符
    for (; i < upperBound; i += 8) {
        if (containsEscaped(IOUtils.getLongLittleEndian(value, i), vecQuote)) {
            break;
        }
    }
    // ...
}
static boolean containsEscaped(long v, long quote) {
/*
for (int i = 0; i < 8; ++i) {
byte c = (byte) data;
if (c == quote || c == '\' || c < ' ') {
return true;
}
data >>>= 8;
}
return false;
*/
long x22 = v ^ quote; // " -> 0x22, ' -> 0x27
long x5c = v ^ 0x5c5c5c5c5c5c5c5cL;
x22 = (x22 - 0x0101010101010101L) & ~x22;
x5c = (x5c - 0x0101010101010101L) & ~x5c;

return ((x22 | x5c | (0x7F7F_7F7F_7F7F_7F7FL - v + 0x1010_1010_1010_1010L) | v) & 0x8080808080808080L) != 0;

}

}
</tr></table>

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [com.alibaba.fastjson2:fastjson2](https://github.com/alibaba/fastjson2) from 2.0.53 to 2.0.54.
- [Release notes](https://github.com/alibaba/fastjson2/releases)
- [Commits](alibaba/fastjson2@2.0.53...2.0.54)

---
updated-dependencies:
- dependency-name: com.alibaba.fastjson2:fastjson2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Jan 13, 2025
@AlbumenJ AlbumenJ merged commit 2bc29d1 into 3.3 Jan 28, 2025
37 of 38 checks passed
@dependabot dependabot bot deleted the dependabot/maven/com.alibaba.fastjson2-fastjson2-2.0.54 branch January 28, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant