Skip to content

Commit 2a7841d

Browse files
committed
docs: better naming and description for native-machine-id
1 parent 2d58470 commit 2a7841d

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/machine-id/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# @mongodb-js/machine-id
1+
# native-machine-id
22

3-
> Native implementation for retrieving unique machine ID without admin privileges or child processes for desktop platforms. Faster and more reliable alternative to node-machine-id.
3+
> Native retrieval of a unique desktop machine ID without admin privileges or child processes. Faster and more reliable alternative to node-machine-id.
44
55
## Installation
66

77
```
8-
npm install @mongodb-js/machine-id
8+
npm install native-machine-id
99
```
1010

1111
Or use it directly in the CLI
1212

1313
```
14-
npx @mongodb-js/machine-id
14+
npx native-machine-id
1515
```
1616

1717
## Usage
1818

1919
### As a module
2020

2121
```javascript
22-
import { getMachineID } from '@mongodb-js/machine-id';
22+
import { getMachineID } from 'native-machine-id';
2323

2424
// Get the machine ID
2525
const hashedId = getMachineID();
@@ -40,17 +40,17 @@ This module provides similar functionality to [node-machine-id](https://www.npmj
4040

4141
Here's a table of performance comparisons between the two libraries, based on the average runtime from 1000 iterations of the `getMachineId` and `machineIdSync` functions, from `scripts/benchmark.ts`:
4242

43-
| Test | node-machine-id | @mongodb-js/machine-id | Improvement |
44-
| ----------- | --------------- | ---------------------- | ----------- |
43+
| Test | node-machine-id | native-machine-id | Improvement |
44+
| ----------- | --------------- | ----------------- | ----------- |
4545
| **Mac** |
46-
| Raw | 10.71ms | 0.0072ms | 1494x |
47-
| Hashed | 12.42ms | 0.0176ms | 707x |
46+
| Raw | 10.71ms | 0.0072ms | 1494x |
47+
| Hashed | 12.42ms | 0.0176ms | 707x |
4848
| **Linux** |
49-
| Raw | 3.26ms | 0.0059ms | 557x |
50-
| Hashed | 3.25ms | 0.0088ms | 368x |
49+
| Raw | 3.26ms | 0.0059ms | 557x |
50+
| Hashed | 3.25ms | 0.0088ms | 368x |
5151
| **Windows** |
52-
| Raw | 45.36ms\* | 0.0122ms | 3704x |
53-
| Hashed | 28.66ms\* | 0.0272ms | 1053x |
52+
| Raw | 45.36ms\* | 0.0122ms | 3704x |
53+
| Hashed | 28.66ms\* | 0.0272ms | 1053x |
5454

5555
\* - Windows tests may be inaccurate due to potential caching.
5656

@@ -60,7 +60,7 @@ If you were previously using `node-machine-id`, you can use the following mappin
6060

6161
```ts
6262
import { createHash } from 'crypto';
63-
import { getMachineId } from '@mongodb-js/machine-id';
63+
import { getMachineId } from 'native-machine-id';
6464

6565
function machineIdSync(original: boolean): string | undefined {
6666
const rawMachineId = getMachineId({ raw: true }).toLowerCase();

packages/machine-id/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@mongodb-js/machine-id",
2+
"name": "native-machine-id",
33
"version": "1.1.0",
4-
"description": "Native implementation for retrieving unique machine ID without admin privileges or child processes for desktop platforms. Faster and more reliable alternative to node-machine-id.",
4+
"description": "Native retrieval of a unique desktop machine ID without admin privileges or child processes. Faster and more reliable alternative to node-machine-id.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"scripts": {

packages/machine-id/scripts/benchmark.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Performance comparison script for machine-id vs node-machine-id
55
*
6-
* This script measures and compares the performance of @mongodb-js/machine-id
6+
* This script measures and compares the performance of native-machine-id
77
* against the node-machine-id package.
88
*/
99

@@ -58,21 +58,21 @@ function runBenchmark() {
5858
const otherTimeRaw = Number(endOtherRaw - startOtherRaw) / 1_000_000; // ms
5959

6060
console.log(
61-
`@mongodb-js/machine-id: ${formatTime(ourTimeRaw)} total, ${formatTime(ourTimeRaw / ITERATIONS)} per call`,
61+
`native-machine-id: ${formatTime(ourTimeRaw)} total, ${formatTime(ourTimeRaw / ITERATIONS)} per call`,
6262
);
6363
console.log(
6464
`node-machine-id: ${formatTime(otherTimeRaw)} total, ${formatTime(otherTimeRaw / ITERATIONS)} per call`,
6565
);
6666
console.log(
67-
`Comparison: @mongodb-js/machine-id is ${formatComparison(ourTimeRaw, otherTimeRaw)}`,
67+
`Comparison: native-machine-id is ${formatComparison(ourTimeRaw, otherTimeRaw)}`,
6868
);
6969

7070
console.log('----------------------------------------');
7171

7272
// Test hashed mode
7373
console.log('Hashed:');
7474

75-
// @mongodb-js/machine-id
75+
// native-machine-id
7676
const startOursHashed = process.hrtime.bigint();
7777
for (let i = 0; i < ITERATIONS; i++) {
7878
getMachineId();
@@ -89,13 +89,13 @@ function runBenchmark() {
8989
const otherTimeHashed = Number(endOtherHashed - startOtherHashed) / 1_000_000; // ms
9090

9191
console.log(
92-
`@mongodb-js/machine-id: ${formatTime(ourTimeHashed)} total, ${formatTime(ourTimeHashed / ITERATIONS)} per call`,
92+
`native-machine-id: ${formatTime(ourTimeHashed)} total, ${formatTime(ourTimeHashed / ITERATIONS)} per call`,
9393
);
9494
console.log(
9595
`node-machine-id: ${formatTime(otherTimeHashed)} total, ${formatTime(otherTimeHashed / ITERATIONS)} per call`,
9696
);
9797
console.log(
98-
`Comparison: @mongodb-js/machine-id is ${formatComparison(ourTimeHashed, otherTimeHashed)}`,
98+
`Comparison: native-machine-id is ${formatComparison(ourTimeHashed, otherTimeHashed)}`,
9999
);
100100
}
101101

0 commit comments

Comments
 (0)