bytedance / bytedance/sonic-cpp

对 parseImpl 进行优化

Open
#134 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
976
Forks
127
PR merge metrics
No merged PRs in 30d

Description

```bash
sonic_force_inline void parseImpl(SAX &sax) {
#define sonic_check_err() \
do { \
if (err_ != kErrorNone) { \
goto err_invalid_char; \
} \
} while (0)

using namespace sonic_json::internal;
// TODO (liuq19): vector is a temporary choice, will optimize in future.
std::vector depth;
const uint32_t kArrMask = 1ull << 31;
const uint32_t kObjMask = 0;
bool found = true;
```

我这边注意到 parseImpl 中解析 json 字符串的时候使用的 depth 为堆变量.
我想我可以将这里修改为栈变量以获得一些性能提升. 同时补充一个简单的单元测试, 给出一个 json 解析的 baseline. 方便后续对 arm 下的性能优化.
拜托帮忙评估一下. @liuq19

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.