nebula-contrib / nebula-node

Nebula Graph Client for Node.js
26 stars 9 forks source link

refactor: v3.1.0-beta.1 #27

Open huaxiabuluo opened 1 year ago

huaxiabuluo commented 1 year ago

Project

Logic optimization

Node support

>=17

wujjpp commented 1 year ago

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

huaxiabuluo commented 1 year ago

@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,我重新修改测试下

huaxiabuluo commented 1 year ago

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);
wey-gu commented 1 month ago

@huaxiabuluo Sorry, may I ask what shape this great change is, please? Is it in a complete state or?