Skip to content

[Java with vector simd to impove perf]  #23

Description

@PeterXiao

JDK 18之后,JDK的默认编码由 uft16 => utf8,且默认都带了vector

下面是一个验证

https://github.com/AugustNagro/utf8.java 该使用了 验证utf8字符性能 在 i7-4930mx上可以跑出2.4GB/secs

Performance

Throughput for twitter.json:
simdjson 就是使用了simd才达到了java的json库15倍以上的性能

new String(buf, UTF_8) Utf8.validate(buf, new LookupTables256()) simdjson::validate_utf8(str, len)
.8 GB/sec 3.52 GB/sec 24 GB/sec
  • The JDK algorithm is very optimized, and uses intrinsics to check negatives (for the ASCII shortcut) and to elide array bound checks.

  • In the vectorized algorithm, 256 bit vectors currently perform best. We cannot go smaller than 128 bit, since nibbles (4 bits) are used to select from the lookup tables.

且 fastjson已经有一个使用jdk vector impove performance的特性,下次跑benchmark的时候,使用fastjson2 请使用 JDK>=17 (并启用该特性)

https://github.com/alibaba/fastjson2/tree/a7134cc6416f4a91662c6b37c6591c624d0e3d4d/incubator-vector

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions