2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-21 00:46:43 +08:00
Commit graph

35 commits

Author SHA1 Message Date
Yi Duan
67cffb15bd
feat:(ast) add fallback api on not-amd64 env (#341)
* feat:(ast) add  fallback api on `not-amd64` env

* test: add native `linux-arm64` CI

* opt: just skip number chars whne `decodeFloat64`

* fmt

* fix: check EOF
2023-01-03 19:47:55 +08:00
linuxsong
2866800519
optimize type assertion (#324) 2022-10-31 12:47:12 +08:00
linuxsong
3e6f839fb6
fix iterator traversal empty object panic (#314) 2022-10-18 10:59:51 +08:00
Chen Yannan
5e54c02172
fmt: move thrid-party tests into another module (#299)
* fix:move benchmarkTests and unitTests related to external json library

* remove extra spaces

* merge go.mod files

* refactor: add external_jsonlib_test into go.work and CI

Co-authored-by: Yi Duan <duanyi.aster@bytedance.com>
2022-09-20 12:02:41 +08:00
Yi Duan
2138136685
feat: support more loose type-casting (#294)
* feat: support more losing type cast

* test: add loose casting tests

* format

* fmt: add license

* fmt: add comments
2022-09-08 16:31:38 +08:00
Yi Duan
cf08d54edd
feat:(ast) support cast null to empty value (#278) 2022-08-22 16:11:26 +08:00
liu
de2dc2c35a
add ValidateString option into decode (#253)
* fix: add escape validate

* feat: add validatestring option

* add print debug

* add jit debug in decoder

* fix go1.16 decoder debug

* fix: not change others

* fix generic parse bug

* remove debug info

* test twitter json

* fix: option typos

* test: add bug test

* fix validate bugs

* fix: validate

* remove files

* re-compile

* update license

* add flags on `skip_xxx()`

* fix internal native tests

* re-compile

* add validstring for perftest

* modify api

* fix readme

* fix comment

* add license

* rename to ValidateString

* fix xprintf.h

* add debug

Co-authored-by: liuqiang <liuqiang.06@bytedance.com>
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2022-08-11 19:06:11 +08:00
Yi Duan
755c0252a9
feat: (ast) support casting V_STRING to number (#262) 2022-07-12 16:27:27 +08:00
Yi Duan
fc6f3743fd
fix:(ast) checkRaw() check if node is nil pointer first (#250) 2022-06-28 14:16:10 +08:00
Yi Duan
2e751bf5db
feat:(ast) Add more strict casting API (#249)
* feat:(ast) Add more strict API

* test: add cast test
2022-06-28 13:27:07 +08:00
liu
f8fb04a184
fix(ub): marshal escape b f as encoding/json (#243)
* fix(ub): marshal b f as encoding/json

* test: fix old test for escape b

Co-authored-by: liuqiang <liuqiang.06@bytedance.com>
2022-06-10 11:21:35 +08:00
liu
410625ca9e
opt: remove bound and loop unrolling in quote (begin to use clang13) (#237)
* opt: remove most bound check in quote

* opt: remove branch in copied escaped chars

* opt: use cache-friendly bool array

* opt: use loop unrolling in quote

* feat: add `-t` for bench.py

Change-Id: I3f41218187597126ef960eab09c6fa6fe252f347

* test:(bench) adjust repeat_time

* test: add Diff on CI

* test: update bench.py

* doc: update README.md

Co-authored-by: liuqiang <liuqiang.06@bytedance.com>
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2022-06-08 21:50:10 +08:00
liu
7475b256ce
support JSON validate (#189)
* fix: check unescaped control chars in decode

* feat: add utf8 validate func

* feat: validate utf8 in json string

* feat: add validateone api

* fix: check unicode pointer for surrogate

* clang12 compile

* feat: Import `Valid()` and `Skip()`

* opt: use looktable

* fix utf-8 validate performance problem

* fix: utf-8 validate bug

* clang12 build

* feat: (encoder) accelerate validating json from `json.Marshaler`

chore!:
- `encoder.NoCompactMarshaler`changes to `encoder.CompactMarshaler`, which means compacting operation is not open by default

* fix: only one json value is `Valid()`

Co-authored-by: liuqiang <liuqiang.06@bytedance.com>
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2022-02-21 16:35:53 +08:00
Yi Duan
c3cb5de704
feat:(ast) support sorting node keys (#164)
* feat: ast.Node support ForEach() iteration (DFS)

Change-Id: Ia53f1db2814036e12b760dfbb7a21094a6abd541

* feat: support Node's key sorting

Change-Id: I0b93d9b4feada853fa2ca9f48277da71948a95be

* fmt

Change-Id: I1a53170959c08f1a32f02b0f163207254a87362c

* test: forbid `checkptr`

Change-Id: I6b34f74ee3bad883f515728300bf735a9e10b0d6

* fmt: add comments

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-12-28 20:29:09 +08:00
Yi Duan
22229eefc3
fix: relocate stack pointers (#156)
* fix: relocate stack pointer _VAR_sv to keep it alive

* fix: add stack pointer _VAR_vk to defend `encoding.TextUnmarshaler`

* fix: align faker func's stack with JIT func's

* fix: clear _Stack memory when err returned

* fix: clear stack pointer before return

* fix: relimit stack-overflow check at `_ValueDecoder`

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-12-20 16:19:12 +08:00
Yi Duan
e80837a84d
fix:(ast) quote string when node.MarshalJSON() (#155)
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-12-15 19:20:18 +08:00
Yi Duan
8405d84e31
feat: optimaze ast.Node API as container of generic values (#150)
* opt: only skip one value when call Iterator.HasNext()

* feat: V_NONE supports Set() and Add()

* feat: add node type V_ANY

* feat: ast.Node implements `json.Unmarshaler`

* fmt: use space instead of tab for indent

* feat: node V_ANY cast to Bool()\Int64()\Float64()\String()\Number()\Map()\Array()Interface()

* feat: V_NULL supports Set() and Add()

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-12-09 15:43:51 +08:00
liu
3f2bab552b
doc: update readme (#143)
* doc: update readme

* test: add SetOne_XX() benchmarks

* doc: update bechmark charts

* doc: fix possible typos

Co-authored-by: liuqiang <liuqiang.06@bytedance.com>
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-12-01 18:03:19 +08:00
liu
9a95e9de00
test: fix timeout problem in issue_test when enable force GC (#135)
Co-authored-by: liuqiang <liuqiang.06@bytedance.com>
2021-11-19 14:10:19 +08:00
Yi Duan
43e4a00e90
fix: add gc_write_barrier checks (#131)
* fix: add gcWriteBarrier for decode

* add gcWriteBarrier for encoder


Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-11-17 11:21:20 +08:00
Yi Duan
442ce696fb
fix: use stackmap of shadow func as jit func's (#127)
* fix: use stackmap of shadow func as jit func's

* fix: use LoadWithFaker in decoder

* fix: LoadWithFaker support go115

* add 'runtime.' prefix on jit funcname to prevent preempt

* add parallel GC tests

* remove no_stack_pointer()

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
Co-authored-by: liuqiang <liuqiang.06@bytedance.com>
2021-11-09 11:50:40 +08:00
Yi Duan
3a25fcac4f
feat: add node.Load()/LoadAll() to support concurrency (#124)
Change-Id: Ic70b61c720a10d16cecc1f3d7c131d81ff6d4071

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-10-28 17:56:09 +08:00
Yi Duan
12e088f9e9
opt(ast): append string instead of []byte (#88)
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
Co-authored-by: Oxygen <chenzhuoyu@users.noreply.github.com>
2021-09-06 16:58:03 +08:00
Yi Duan
fa5f5026d9
opt(ast): speed up api (#85)
- inline findkey()
- use std append() instead of runtime.memmove()

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-09-03 20:05:52 +08:00
Yi Duan
1f13d31b5a
chore!: return error for scanning API (#81)
* chore!: return error for cast API

BREAKING CHANGE:
- Set()/Unset()/SetByIndex()/UnsetByIndex/Add() 
- Raw()/Bool()/Int64()/Float64()/Number()/Len()/Cap()
- Values()/Properties()/Map()/Array()/Interface()

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-08-30 17:14:38 +08:00
Yi Duan
6aec2f3722
feat(ast): Node supports MarshalJson() (#84)
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-08-27 18:28:56 +08:00
Yi Duan
8c119dd72d
feat(ast): support Node.Unset() and optimize Node.Get() (#80)
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-08-24 13:23:55 +08:00
duanyi.aster
6b4022a19f fix: parser.ExportError() exceeds slice boundary 2021-07-20 16:47:59 +08:00
duanyi.aster
91e58904fe doc update benchmarks on README.md 2021-07-03 00:29:52 +08:00
Yi Duan
e9b6634cac
feat: ast supports Node.Exists()/MapUseNode()/ArrayUseNode() (#19)
* feat: ast supports Node.Exists()/MapUseNode()/ArrayUseNode()

* jump table for swithcRawType

Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-06-24 16:37:32 +08:00
chenzhuoyu
b2fbad7b4c feat: rewrite generic decoder in Go, using Finite State Machine 2021-06-16 23:05:21 +08:00
chenzhuoyu
34fa8d64a8 feat: CPU feature detection support 2021-06-10 17:14:25 +08:00
Yi Duan
accee2e689
feat: support UseNumber for ast (#14)
Co-authored-by: duanyi.aster <duanyi.aster@bytedance.com>
2021-06-09 15:58:27 +08:00
chenzhuoyu
66d6c789d4 chore: minor fixes 2021-06-02 20:12:04 +08:00
chenzhuoyu
fbe0828190 chore: make it open-source 2021-05-28 23:58:58 +08:00