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

doc: Add useful V8 option section #32262

Closed
wants to merge 9 commits into from
Closed
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,28 @@ threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value
greater than `4` (its current default value). For more information, see the
[libuv threadpool documentation][].

## Useful V8 options

V8 has its own set of CLI options. Any V8 CLI option that is provided to `node` will
be passed on to V8 to handle. V8's options have _no stability guarantee_.
The V8 team themselves don't consider them to be part of their formal API,
and reserve the right to change them at any time. The Node.js team does not
consider them covered by the Node.js stability guarantees. Many of the V8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit:

Suggested change
and reserve the right to change them at any time. The Node.js team does not
consider them covered by the Node.js stability guarantees. Many of the V8
and reserve the right to change them at any time. Likewise, they are not
covered by the Node.js stability guarantees. Many of the V8

options are of interest only to V8 developers. Despite this, there is a small
set of V8 options that are widely applicable to the Node.js, and they are
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set of V8 options that are widely applicable to the Node.js, and they are
set of V8 options that are widely applicable to Node.js, and they are

documented here. V8 options that are allowed are:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
documented here. V8 options that are allowed are:
documented here:


### `--max-old-space-size=SIZE` (in Mbytes)

Sets the max memory size of V8 old memory section. As memory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sets the max memory size of V8 old memory section. As memory
Sets the max memory size of V8's old memory section. As memory

consumption approaches the limit, V8 will spend more time on
garbage collection in an effort to free unused memory.

On a machine with 2GB of memory it suggested to set 1.5GB
Copy link
Contributor

@mscdex mscdex Mar 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On a machine with 2GB of memory it suggested to set 1.5GB
On a machine with 2GB of memory it is suggested to set this to 1536 (1.5GB)

to leave some memory for other uses and avoid swapping.

E.g. `node --max-old-space-size=1536 index.js`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit: Delete this line.

Copy link
Contributor Author

@nimit95 nimit95 Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally feel an example helps a lot when being introduced to a flag. It clearly shows how to pass an argument. @Trott

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally feel an example helps a lot when being introduced to a flag

If we want to provide an example, it should conform with the formatting of the other examples provided elsewhere in the doc. Otherwise, each entry is inventing its own example formatting, and we definitely do not want that. The existing format is more useful than this as it provides context, such as what the anticipated output might look like. So, this example might show the error one might get if running without the flag, then show the command succeeding with the flag.

(That said, most of our entries do not contain examples and that seems appropriate in this document.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree with your point, Can you point me to some of the correct existing formats?
What I see a mixture of formats, some given below

  1. node --name-of-flag index.mjs
  2. node --name-of-flag

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mean the format of the command itself. I mean the markdown formatting that denotes an example.

```console
$ node --cpu-prof index.js
$ ls *.cpuprofile
CPU.20190409.202950.15293.0.0.cpuprofile
```

Copy link
Contributor Author

@nimit95 nimit95 Apr 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott can you check out the formatting once now.


[`--openssl-config`]: #cli_openssl_config_file
[`Buffer`]: buffer.html#buffer_class_buffer
[`SlowBuffer`]: buffer.html#buffer_class_slowbuffer
Expand Down