Skip to content

Commit

Permalink
pkg: update lint and fix rbt performance for v14 and v16.
Browse files Browse the repository at this point in the history
rbt: remove public class fields (minor) as node v14 and v16 struggle
with performance when they are declared. (almost 5x)
  • Loading branch information
nodech committed Apr 25, 2024
1 parent f4293e8 commit b7c0914
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 50 deletions.
18 changes: 4 additions & 14 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
{
"env": {
"es6": true,
"es2022": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readable",
"BigInt": "readable",
"BigInt64Array": "readable",
"BigUint64Array": "readable",
"queueMicrotask": "readable",
"SharedArrayBuffer": "readable",
"TextEncoder": "readable",
"TextDecoder": "readable"
},
"overrides": [
{
"files": ["*.mjs"],
Expand All @@ -39,13 +29,13 @@
},
"rules": {
"max-len": "off",
"prefer-arrow-callback": "off"
"prefer-arrow-callback": "off",
"no-return-assign": "off"
}
}
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 10,
"ecmaVersion": 13,
"ecmaFeatures": {
"globalReturn": true
},
Expand Down
1 change: 1 addition & 0 deletions lib/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class BaseKey {

assert(typeof name === 'string');

// eslint-disable-next-line no-prototype-builtins
if (!types.hasOwnProperty(name))
throw new Error(`Invalid type name: ${name}.`);

Expand Down
36 changes: 0 additions & 36 deletions lib/rbt.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,24 +759,6 @@ class RBTIterator {
*/

class RBTNode {
/** @type {Buffer} */
key;

/** @type {Buffer} */
value;

/** @type {Number} */
color;

/** @type {RBTNode|RBTSentinel} */
parent;

/** @type {RBTNode|RBTSentinel} */
left;

/** @type {RBTNode|RBTSentinel} */
right;

/**
* Create an RBT node.
* @constructor
Expand Down Expand Up @@ -849,24 +831,6 @@ class RBTNode {
*/

class RBTSentinel {
/** @type {null} */
key;

/** @type {null} */
value;

/** @type {Number} */
color;

/** @type {null} */
parent;

/** @type {null} */
left;

/** @type {null} */
right;

/**
* Create an RBT Sentinel Node.
* @constructor
Expand Down

0 comments on commit b7c0914

Please sign in to comment.