Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: v3.1.0-beta.1 #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

huaxiabuluo
Copy link

@huaxiabuluo huaxiabuluo commented Oct 23, 2023

Project

  • babel --> swc
  • mocha --> jest
  • using npm package thrift
  • build logic

Logic optimization

  • response data traverse

Node support

>=17

@wujjpp
Copy link
Collaborator

wujjpp commented Oct 23, 2023

@huaxiabuluo @wey-gu
babel --> swc : ok,
mocha --> jest: ok
using npm package thrift: ok
build logic:ok
response data traverse: ok

  • node18最好再确认一下,centos7不额外更新glibc的情况下,node18跑不起来的
  • 使用napi 替代 v8 api,兼容性会提升,但是之前我们做benchmark发现,性能上会稍微有一点差异(可以忽略的那种)

@huaxiabuluo
Copy link
Author

huaxiabuluo commented Oct 24, 2023

@huaxiabuluo @wey-gu babel --> swc : ok, mocha --> jest: ok using npm package thrift: ok build logic:ok response data traverse: ok

  • node18最好再确认一下,centos7不额外更新glibc的情况下,node18跑不起来的
  • 使用napi 替代 v8 api,兼容性会提升,但是之前我们做benchmark发现,性能上会稍微有一点差异(可以忽略的那种)

「 node18最好再确认一下,centos7不额外更新glibc的情况下,node18跑不起来的」
好问题,之前主要考虑了 nodejs 的版本维护周期,没考虑到 centos7,我重新修改测试下

* refactor: test case
@huaxiabuluo
Copy link
Author

huaxiabuluo commented Nov 1, 2023

bytesToLongLongString 函数可使用 node 内置方法来进行替换(性能会有很大提升)

const bytesToLongLongString = (...args: Parameters<typeof Buffer.from>) => {
  const buf = Buffer.from(...args);
  const num = buf.readBigInt64BE();
  return num.toString();
}

const s = '-7897618527020261406';
const buffer = [146, 102, 5, 203, 5, 105, 223, 226];

expect(bytesToLongLongString(buffer)).toBe(s);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants