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

Restrict process and Buffer globals to CommonJS #26334

Closed
wants to merge 3 commits into from

Conversation

guybedford
Copy link
Contributor

@guybedford guybedford commented Feb 27, 2019

This PR deprecates access to global.process and global.Buffer access in ECMAScript modules only, while ensuring they continue to behave fine for all CommonJS modules and contexts providing comprehensive backwards compatibility.

This is done by making them getters which check the context in which they are called and throw when inside an ECMAScript module. To avoid this getter slowpath in accesses, process and Buffer are also added as a context to the compileFunction wrapper in CJS. In addition these getters are only defined as soon as there is a load of an ECMAScript module to avoid any slowdowns in these cases.

The benefits of this are that then ECMAScript modules don't by default have to assume access to all the root-level-security functions and properties on process allowing access control to be added in future, as well as helping towards browser compatibility by making process an import.

ECMAScript modules share the same realm global, so there isn't a way to do this otherwise. In addition once users start running and writing and publishing ECMAScript modules in Node.js that assume the process and Buffer globals exist, it becomes very difficult to change this then.

For these reasons I think it is quite important to land this with the ECMAScript modules implementation in Node.js to provide these properties, or risk never being able to provide them at all in Node.js due to ecosystem compatibility constraints.

Previous discussion: nodejs/modules#235.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

@guybedford sadly an error occured when I tried to trigger a build :(

@devsnek
Copy link
Member

devsnek commented Feb 27, 2019

can you undo all the unrelated changes to context.js?

lib/internal/bootstrap/context.js Outdated Show resolved Hide resolved
@ljharb
Copy link
Member

ljharb commented Feb 27, 2019

While Buffer is fine, process is necessary for environment detection, and will continue to be necessary in ESM. I don’t see what the benefit is of denying it as a global there.

@ljharb
Copy link
Member

ljharb commented Feb 27, 2019

In other words, this PR provides a valid technical means to remove these globals from ESM, but it will still create a world where many kinds of CJS modules will be unable to be refactored to ESM, or will break if they are naively refactored (ie, will silently start going down browser code paths, because the use of typeof won’t trigger any deprecation warnings)

lib/internal/bootstrap/context.js Outdated Show resolved Hide resolved
lib/internal/modules/cjs/loader.js Outdated Show resolved Hide resolved
@guybedford
Copy link
Contributor Author

While Buffer is fine, process is necessary for environment detection, and will continue to be necessary in ESM.

import.meta.NODE_ENV or similar could be provided as an alternative for environment detections.

I don’t see what the benefit is of denying it as a global there.

process.binding provides access to all native bindings. process.hrtime provides high resolution timers. process provides a hugely complex interface without any encapsulation or access control. Including it by default in ES Modules means living with those design decisions for the rest of Node.js's lifetime. If that is what we want then sure, but at least it should be an explicit decision and not something that just happens by default.

@joyeecheung
Copy link
Member

Process-related: if we are going to do this, we need to doc-deprecate first before emitting warnings.

@addaleax addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 27, 2019
@ljharb
Copy link
Member

ljharb commented Feb 27, 2019

Using import.meta (would that work in CJS too? It’s important imo that both cjs and ESM have the same mechanisms available to them) would force a build tool on what was a simple typeof check.

It sounds like what you really want is to deprecate process.binding and process.hrtime, and perhaps some others - can we focus on deprecating those, instead of throwing the baby out with the bathwater by getting rid of the entire useful global?

@guybedford
Copy link
Contributor Author

It sounds like what you really want is to deprecate process.binding and process.hrtime, and perhaps some others - can we focus on deprecating those, instead of throwing the baby out with the bathwater by getting rid of the entire useful global?

"Fixing" process to be a secure global is what we'd be left with otherwise certainly. It would also mean individually replacing all of these APIs with alternatives, so we'd be looking at dozens of individual API changes instead. It won't be pretty, but yes that is the alternative to work towards these properties.

The other side of that is that we wouldn't want ES module users to use process.binding to load native modules as if that gets traction in the ecosystem then we can never remove it.

@devsnek
Copy link
Member

devsnek commented Feb 27, 2019

fwiw process.binding is being deprecated anyway.

@guybedford
Copy link
Contributor Author

@devsnek do you have a link? What is it being replaced with?

@devsnek
Copy link
Member

devsnek commented Feb 27, 2019

#22160

it's not being replaced with anything

@guybedford
Copy link
Contributor Author

guybedford commented Feb 27, 2019

@devsnek interesting - that is important to know as we then effectively have no means of loading binaries from within ECMAScript modules, without using createRequireFromPath. Edit: mixed this up with process.dlopen!

Note also what a huge effort changing process.binding is. Try multiplying that by dozens to understand what it would mean to make process safe. ES Modules give us a chance to encapsulate. It's certainly not the end of the world if we can't, but it's an opportunity we have that I think is important to consider carefully.

@zenparsing
Copy link

A couple of questions that come to mind:

  • How does requiring an import versus using a global property help to create an attenuated privelige environment? It seems to be equivalent at first glance.
  • Does removing things from the global object actually make code more cross-platform? There are tons of platform APIs on the web that are exposed via global properties and I see no effort to move all web APIs to modules.
  • Can not sandboxes/realms be used to create the attenuated environment that you are interested in? Won't you have to use sandboxes anyway in order to intercede on imports?

Thanks!

@bmeck
Copy link
Member

bmeck commented Feb 27, 2019

@zenparsing

  • How does requiring an import versus using a global property help to create an attenuated privelige environment? It seems to be equivalent at first glance.

Different hooks for attenuation / different analysis of dynamic access. Dynamic global access is quite hard to check for and you get lots of bailouts as can be seen in some tools for auditing like https://github.com/bmeck/tofu .

  • Does removing things from the global object actually make code more cross-platform? There are tons of platform APIs on the web that are exposed via global properties and I see no effort to move all web APIs to modules.

Yes and no; by moving it to an import, it still allows it to be polyfilled via means like import hooks or redirection. It however does help show when something is used that is not present in all environments more easily per the point above.

  • Can not sandboxes/realms be used to create the attenuated environment that you are interested in? Won't you have to use sandboxes anyway in order to intercede on imports?

You don't need sandboxes for imports if you have import hooks. You do need sandboxes for attenuating globals (which is also complex once you start talking about shared intrinsics). Realms are not going to be ready anytime soon for this that I can tell. The underpinnings to even allow Realms as often talked about is still somewhat up in the air per tc39/ecma262#1420

Overall I don't think we should equate global attenuation with import attenuation.

@guybedford
Copy link
Contributor Author

Process-related: if we are going to do this, we need to doc-deprecate first before emitting warnings.

Ok I will update along these lines. @joyeecheung does that mean the deprecation warnings can be added as a semver minor?

@guybedford guybedford force-pushed the module-globals branch 5 times, most recently from 63618d0 to 8968f53 Compare February 28, 2019 12:16
@mcollina
Copy link
Member

I’ll post the data in the rowesr form. Have we tried running the http benchmarks in core?

@guybedford
Copy link
Contributor Author

guybedford commented Jul 26, 2019

@mcollina here are the http benchmark results -

Http benchmarks
01:08:36  http/bench-parser.js n=100000 len=16                                                                          0.89 %       ±1.44% ±1.92%  ±2.52%
01:08:36  http/bench-parser.js n=100000 len=32                                                                         -0.12 %       ±2.10% ±2.80%  ±3.68%
01:08:36  http/bench-parser.js n=100000 len=4                                                                          -0.75 %       ±3.14% ±4.20%  ±5.51%
01:08:36  http/bench-parser.js n=100000 len=8                                                                    *      1.81 %       ±1.40% ±1.86%  ±2.43%
01:08:36  http/check_invalid_header_char.js n=1000000 input=''                                                          0.96 %       ±3.62% ±4.83%  ±6.29%
01:08:36  http/check_invalid_header_char.js n=1000000 input='\177'                                                     -0.93 %       ±5.16% ±6.86%  ±8.93%
01:08:36  http/check_invalid_header_char.js n=1000000 input='1'                                                        -2.99 %       ±3.93% ±5.25%  ±6.87%
01:08:36  http/check_invalid_header_char.js n=1000000 input='20091'                                                    -1.93 %       ±3.25% ±4.32%  ±5.63%
01:08:36  http/check_invalid_header_char.js n=1000000 input='close'                                                    -2.26 %       ±3.99% ±5.31%  ±6.91%
01:08:36  http/check_invalid_header_char.js n=1000000 input='en-US'                                                    -3.95 %       ±4.12% ±5.48%  ±7.13%
01:08:36  http/check_invalid_header_char.js n=1000000 input='foo\\nbar'                                                 1.25 %       ±4.63% ±6.17%  ±8.04%
01:08:36  http/check_invalid_header_char.js n=1000000 input='group_acmeair'                                             1.03 %       ±2.92% ±3.90%  ±5.09%
01:08:36  http/check_invalid_header_char.js n=1000000 input='gzip'                                                     -2.48 %       ±3.83% ±5.12%  ±6.69%
01:08:36  http/check_invalid_header_char.js n=1000000 input='keep-alive'                                         *     -3.68 %       ±3.31% ±4.41%  ±5.74%
01:08:36  http/check_invalid_header_char.js n=1000000 input='LONG_AND_INVALID'                                         -1.11 %       ±2.01% ±2.67%  ±3.48%
01:08:36  http/check_invalid_header_char.js n=1000000 input='private'                                                   1.09 %       ±3.84% ±5.11%  ±6.65%
01:08:36  http/check_invalid_header_char.js n=1000000 input='SAMEORIGIN'                                               -1.13 %       ±4.42% ±5.89%  ±7.67%
01:08:36  http/check_invalid_header_char.js n=1000000 input='Sat, 07 May 2016 16:54:48 GMT'                             1.36 %       ±4.62% ±6.17%  ±8.08%
01:08:36  http/check_invalid_header_char.js n=1000000 input='text/html; charset=utf-8'                                  0.41 %       ±3.22% ±4.28%  ±5.57%
01:08:36  http/check_invalid_header_char.js n=1000000 input='text/plain'                                               -1.29 %       ±4.30% ±5.73%  ±7.46%
01:08:36  http/check_invalid_header_char.js n=1000000 input='\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tFoo bar baz'                 1.24 %       ±3.26% ±4.35%  ±5.66%
01:08:36  http/check_invalid_header_char.js n=1000000 input='中文呢'                                                   -1.20 %       ±5.85% ±7.79% ±10.18%
01:08:36  http/check_is_http_token.js n=1000000 key=':'                                                                -0.74 %       ±3.41% ±4.53%  ±5.90%
01:08:36  http/check_is_http_token.js n=1000000 key='((((())))'                                                         2.38 %       ±5.32% ±7.09%  ±9.25%
01:08:36  http/check_is_http_token.js n=1000000 key='@@'                                                               -1.60 %       ±4.09% ±5.45%  ±7.12%
01:08:36  http/check_is_http_token.js n=1000000 key='Accept-Ranges'                                                     2.25 %       ±4.56% ±6.07%  ±7.90%
01:08:36  http/check_is_http_token.js n=1000000 key=':alternate-protocol'                                               0.85 %       ±4.75% ±6.32%  ±8.23%
01:08:36  http/check_is_http_token.js n=1000000 key='alternate-protocol:'                                              -0.84 %       ±3.15% ±4.19%  ±5.45%
01:08:36  http/check_is_http_token.js n=1000000 key='alternate-protocol'                                                2.60 %       ±4.82% ±6.47%  ±8.52%
01:08:36  http/check_is_http_token.js n=1000000 key='alt-svc'                                                          -0.79 %       ±3.70% ±4.92%  ±6.41%
01:08:36  http/check_is_http_token.js n=1000000 key='Cache-Control'                                                     1.26 %       ±3.66% ±4.87%  ±6.34%
01:08:36  http/check_is_http_token.js n=1000000 key='Connection'                                                        1.24 %       ±3.84% ±5.11%  ±6.65%
01:08:36  http/check_is_http_token.js n=1000000 key='Content-Encoding'                                                 -2.69 %       ±2.75% ±3.67%  ±4.78%
01:08:36  http/check_is_http_token.js n=1000000 key='content-length'                                                    2.38 %       ±2.98% ±3.97%  ±5.18%
01:08:36  http/check_is_http_token.js n=1000000 key='Content-Location'                                                  0.35 %       ±3.61% ±4.80%  ±6.25%
01:08:36  http/check_is_http_token.js n=1000000 key='content-type'                                                      2.43 %       ±2.87% ±3.82%  ±4.97%
01:08:36  http/check_is_http_token.js n=1000000 key='Content-Type'                                                     -0.05 %       ±3.75% ±4.99%  ±6.52%
01:08:36  http/check_is_http_token.js n=1000000 key='date'                                                              2.76 %       ±3.67% ±4.90%  ±6.39%
01:08:36  http/check_is_http_token.js n=1000000 key='ETag'                                                              3.01 %       ±6.29% ±8.41% ±11.03%
01:08:36  http/check_is_http_token.js n=1000000 key='Expires'                                                          -0.96 %       ±4.35% ±5.79%  ±7.55%
01:08:36  http/check_is_http_token.js n=1000000 key='Keep-Alive'                                                        0.64 %       ±3.54% ±4.70%  ±6.12%
01:08:36  http/check_is_http_token.js n=1000000 key='Last-Modified'                                                     2.50 %       ±3.76% ±5.00%  ±6.52%
01:08:36  http/check_is_http_token.js n=1000000 key='location'                                                          1.51 %       ±3.40% ±4.53%  ±5.90%
01:08:36  http/check_is_http_token.js n=1000000 key='server'                                                            0.21 %       ±3.51% ±4.67%  ±6.09%
01:08:36  http/check_is_http_token.js n=1000000 key='Server'                                                     *     -3.22 %       ±3.14% ±4.18%  ±5.44%
01:08:36  http/check_is_http_token.js n=1000000 key='status'                                                           -0.59 %       ±3.18% ±4.23%  ±5.51%
01:08:36  http/check_is_http_token.js n=1000000 key='TCN'                                                               1.52 %       ±4.74% ±6.30%  ±8.21%
01:08:36  http/check_is_http_token.js n=1000000 key='Transfer-Encoding'                                                -0.03 %       ±2.73% ±3.63%  ±4.72%
01:08:36  http/check_is_http_token.js n=1000000 key='Vary'                                                             -1.57 %       ±4.38% ±5.83%  ±7.59%
01:08:36  http/check_is_http_token.js n=1000000 key='version'                                                           3.50 %       ±5.80% ±7.74% ±10.14%
01:08:36  http/check_is_http_token.js n=1000000 key='x-frame-options'                                                  -1.31 %       ±3.96% ±5.28%  ±6.89%
01:08:36  http/check_is_http_token.js n=1000000 key='x-xss-protection'                                                 -2.06 %       ±2.51% ±3.34%  ±4.35%
01:08:36  http/check_is_http_token.js n=1000000 key='中文呢'                                                            0.14 %       ±5.54% ±7.39%  ±9.63%
01:08:36  http/chunked.js c=100 len=1 n=16 benchmarker='wrk'                                                   ***     -1.39 %       ±0.65% ±0.86%  ±1.12%
01:08:36  http/chunked.js c=100 len=1 n=1 benchmarker='wrk'                                                             0.05 %       ±0.27% ±0.37%  ±0.48%
01:08:36  http/chunked.js c=100 len=1 n=4 benchmarker='wrk'                                                            -0.06 %       ±0.28% ±0.38%  ±0.49%
01:08:36  http/chunked.js c=100 len=1 n=8 benchmarker='wrk'                                                            -0.24 %       ±0.26% ±0.35%  ±0.45%
01:08:36  http/chunked.js c=100 len=256 n=16 benchmarker='wrk'                                                 ***     -2.19 %       ±0.80% ±1.06%  ±1.38%
01:08:36  http/chunked.js c=100 len=256 n=1 benchmarker='wrk'                                                           0.04 %       ±0.29% ±0.39%  ±0.51%
01:08:36  http/chunked.js c=100 len=256 n=4 benchmarker='wrk'                                                          -0.28 %       ±0.29% ±0.38%  ±0.50%
01:08:36  http/chunked.js c=100 len=256 n=8 benchmarker='wrk'                                                          -0.29 %       ±0.33% ±0.44%  ±0.57%
01:08:36  http/chunked.js c=100 len=64 n=16 benchmarker='wrk'                                                  ***     -1.72 %       ±0.71% ±0.94%  ±1.23%
01:08:36  http/chunked.js c=100 len=64 n=1 benchmarker='wrk'                                                            0.05 %       ±0.26% ±0.34%  ±0.44%
01:08:36  http/chunked.js c=100 len=64 n=4 benchmarker='wrk'                                                            0.02 %       ±0.29% ±0.39%  ±0.50%
01:08:36  http/chunked.js c=100 len=64 n=8 benchmarker='wrk'                                                           -0.06 %       ±0.30% ±0.40%  ±0.52%
01:08:36  http/client-request-body.js method='end' len=1024 type='asc' dur=5                                           -3.97 %       ±7.03% ±9.40% ±12.32%
01:08:36  http/client-request-body.js method='end' len=1024 type='buf' dur=5                                            2.47 %       ±5.50% ±7.31%  ±9.52%
01:08:36  http/client-request-body.js method='end' len=1024 type='utf' dur=5                                            0.22 %       ±6.97% ±9.28% ±12.09%
01:08:36  http/client-request-body.js method='end' len=256 type='asc' dur=5                                            -0.82 %       ±5.28% ±7.03%  ±9.17%
01:08:36  http/client-request-body.js method='end' len=256 type='buf' dur=5                                     **      7.86 %       ±4.86% ±6.52%  ±8.58%
01:08:36  http/client-request-body.js method='end' len=256 type='utf' dur=5                                             1.59 %       ±7.22% ±9.61% ±12.52%
01:08:36  http/client-request-body.js method='end' len=32 type='asc' dur=5                                              3.82 %       ±4.82% ±6.42%  ±8.38%
01:08:36  http/client-request-body.js method='end' len=32 type='buf' dur=5                                              0.63 %       ±6.61% ±8.80% ±11.46%
01:08:36  http/client-request-body.js method='end' len=32 type='utf' dur=5                                             -2.99 %       ±4.55% ±6.09%  ±8.00%
01:08:36  http/client-request-body.js method='write' len=1024 type='asc' dur=5                                          0.64 %       ±6.68% ±8.88% ±11.56%
01:08:36  http/client-request-body.js method='write' len=1024 type='buf' dur=5                                          0.22 %       ±3.90% ±5.21%  ±6.84%
01:08:36  http/client-request-body.js method='write' len=1024 type='utf' dur=5                                          1.71 %       ±5.79% ±7.70% ±10.02%
01:08:36  http/client-request-body.js method='write' len=256 type='asc' dur=5                                          -0.44 %       ±5.99% ±7.97% ±10.37%
01:08:36  http/client-request-body.js method='write' len=256 type='buf' dur=5                                          -0.39 %       ±5.22% ±6.95%  ±9.06%
01:08:36  http/client-request-body.js method='write' len=256 type='utf' dur=5                                           0.22 %       ±6.86% ±9.13% ±11.89%
01:08:36  http/client-request-body.js method='write' len=32 type='asc' dur=5                                           -0.60 %       ±6.55% ±8.71% ±11.35%
01:08:36  http/client-request-body.js method='write' len=32 type='buf' dur=5                                            3.31 %       ±6.31% ±8.39% ±10.92%
01:08:36  http/client-request-body.js method='write' len=32 type='utf' dur=5                                           -3.25 %       ±6.39% ±8.50% ±11.06%
01:08:36  http/cluster.js c=500 len=102400 type='buffer' benchmarker='wrk'                                             -2.62 %       ±4.47% ±5.95%  ±7.75%
01:08:36  http/cluster.js c=500 len=102400 type='bytes' benchmarker='wrk'                                               0.55 %       ±3.66% ±4.87%  ±6.34%
01:08:36  http/cluster.js c=500 len=1024 type='buffer' benchmarker='wrk'                                               -3.16 %       ±3.20% ±4.25%  ±5.54%
01:08:36  http/cluster.js c=500 len=1024 type='bytes' benchmarker='wrk'                                        ***     -7.76 %       ±3.32% ±4.42%  ±5.77%
01:08:36  http/cluster.js c=500 len=4 type='buffer' benchmarker='wrk'                                          ***     -8.73 %       ±3.70% ±4.92%  ±6.40%
01:08:36  http/cluster.js c=500 len=4 type='bytes' benchmarker='wrk'                                           ***     -8.26 %       ±3.37% ±4.48%  ±5.83%
01:08:36  http/cluster.js c=50 len=102400 type='buffer' benchmarker='wrk'                                        *     -5.34 %       ±4.15% ±5.52%  ±7.19%
01:08:36  http/cluster.js c=50 len=102400 type='bytes' benchmarker='wrk'                                                2.04 %       ±5.20% ±6.92%  ±9.01%
01:08:36  http/cluster.js c=50 len=1024 type='buffer' benchmarker='wrk'                                        ***     -6.31 %       ±3.55% ±4.72%  ±6.14%
01:08:36  http/cluster.js c=50 len=1024 type='bytes' benchmarker='wrk'                                         ***     -6.75 %       ±3.86% ±5.14%  ±6.69%
01:08:36  http/cluster.js c=50 len=4 type='buffer' benchmarker='wrk'                                             *     -4.56 %       ±3.99% ±5.31%  ±6.93%
01:08:36  http/cluster.js c=50 len=4 type='bytes' benchmarker='wrk'                                              *     -4.90 %       ±4.07% ±5.42%  ±7.05%
01:08:36  http/create-clientrequest.js e=1 arg='options' url='idn'                                                     -2.00 %       ±5.39% ±7.17%  ±9.33%
01:08:36  http/create-clientrequest.js e=1 arg='options' url='long'                                                     1.43 %       ±4.58% ±6.10%  ±7.94%
01:08:36  http/create-clientrequest.js e=1 arg='options' url='wpt'                                                      0.72 %       ±4.29% ±5.71%  ±7.44%
01:08:36  http/create-clientrequest.js e=1 arg='string' url='idn'                                                      -3.89 %       ±5.10% ±6.79%  ±8.86%
01:08:36  http/create-clientrequest.js e=1 arg='string' url='long'                                                     -1.96 %       ±4.46% ±5.94%  ±7.72%
01:08:36  http/create-clientrequest.js e=1 arg='string' url='wpt'                                                      -2.83 %       ±4.92% ±6.56%  ±8.55%
01:08:36  http/create-clientrequest.js e=1 arg='URL' url='idn'                                                         -3.55 %       ±4.66% ±6.19%  ±8.06%
01:08:36  http/create-clientrequest.js e=1 arg='URL' url='long'                                                        -4.42 %       ±4.68% ±6.22%  ±8.10%
01:08:36  http/create-clientrequest.js e=1 arg='URL' url='wpt'                                                         -0.90 %       ±5.01% ±6.68%  ±8.73%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=1048576 type='asc' benchmarker='wrk'                          3.03 %       ±3.87% ±5.15%  ±6.70%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=1048576 type='buf' benchmarker='wrk'                         -3.43 %       ±5.62% ±7.47%  ±9.73%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=1048576 type='utf' benchmarker='wrk'                   *      3.17 %       ±3.06% ±4.07%  ±5.30%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=131072 type='asc' benchmarker='wrk'                          -0.98 %       ±2.11% ±2.81%  ±3.66%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=131072 type='buf' benchmarker='wrk'                          -3.16 %       ±3.62% ±4.82%  ±6.27%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=131072 type='utf' benchmarker='wrk'                           2.92 %       ±2.95% ±3.94%  ±5.15%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=262144 type='asc' benchmarker='wrk'                           0.41 %       ±2.48% ±3.30%  ±4.30%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=262144 type='buf' benchmarker='wrk'                          -0.58 %       ±4.48% ±5.96%  ±7.77%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=262144 type='utf' benchmarker='wrk'                          -0.14 %       ±2.62% ±3.49%  ±4.55%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=65536 type='asc' benchmarker='wrk'                            1.38 %       ±2.54% ±3.37%  ±4.39%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=65536 type='buf' benchmarker='wrk'                            5.17 %       ±5.55% ±7.39%  ±9.63%
01:08:36  http/end-vs-write-end.js method='end' c=100 len=65536 type='utf' benchmarker='wrk'                           -0.43 %       ±2.32% ±3.09%  ±4.02%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=1048576 type='asc' benchmarker='wrk'                        1.19 %       ±4.54% ±6.04%  ±7.86%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=1048576 type='buf' benchmarker='wrk'                 *     -5.06 %       ±4.72% ±6.29%  ±8.18%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=1048576 type='utf' benchmarker='wrk'                        2.88 %       ±6.18% ±8.22% ±10.70%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=131072 type='asc' benchmarker='wrk'                         2.81 %       ±4.81% ±6.39%  ±8.32%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=131072 type='buf' benchmarker='wrk'                        -1.93 %       ±3.37% ±4.49%  ±5.84%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=131072 type='utf' benchmarker='wrk'                         1.17 %       ±2.59% ±3.44%  ±4.48%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=262144 type='asc' benchmarker='wrk'                        -2.48 %       ±4.10% ±5.47%  ±7.15%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=262144 type='buf' benchmarker='wrk'                         0.70 %       ±3.95% ±5.25%  ±6.84%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=262144 type='utf' benchmarker='wrk'                 **      4.06 %       ±2.96% ±3.95%  ±5.19%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=65536 type='asc' benchmarker='wrk'                          0.82 %       ±2.80% ±3.72%  ±4.85%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=65536 type='buf' benchmarker='wrk'                         -1.06 %       ±4.90% ±6.52%  ±8.49%
01:08:36  http/end-vs-write-end.js method='write' c=100 len=65536 type='utf' benchmarker='wrk'                         -1.86 %       ±3.31% ±4.40%  ±5.75%
01:08:36  http/headers.js len=100 n=1000 benchmarker='wrk'                                                              0.54 %       ±2.53% ±3.36%  ±4.38%
01:08:36  http/headers.js len=100 n=10 benchmarker='wrk'                                                                0.72 %       ±4.92% ±6.55%  ±8.52%
01:08:36  http/headers.js len=1 n=1000 benchmarker='wrk'                                                               -0.23 %       ±3.17% ±4.23%  ±5.54%
01:08:36  http/headers.js len=1 n=10 benchmarker='wrk'                                                                 -1.21 %       ±4.17% ±5.55%  ±7.23%

@ljharb
Copy link
Member

ljharb commented Jul 27, 2019

@bmeck the problem is that i don’t consider the process object to be problematic, and more importantly i consider a number of properties of it being available as globals to be critical. The request is to not avoid the harder but more correct task of sequestering the actually dangerous parts rather than deprecating what is overwhelmingly the means of environment detection, cross-package config (NODE_ENV, BABEL_ENV, and many others), nextTick (which isn’t a global like setTimeout but is just as important), the cwd which is how tons of tools locate the current project dir, etc - saying “you can just import the module” minimizes the herculean task it will be for the ecosystem to actually do that, and imo simultaneously hugely overexaggerates the security benefits of this change.

@bmeck
Copy link
Member

bmeck commented Jul 27, 2019

@ljharb I do not believe that approach to be more correct. With the dependencies remapping in policies, you can control the access to modules. However, we cannot well control access to globals and their properties without something like Compartments and the ECMA262 PR to allow them. As it stands, we simply do not have the proper mechanism to control globals in the way you describe at a granular level.

@ljharb
Copy link
Member

ljharb commented Jul 27, 2019

I’d invite you to consider that the consequence of not having the mechanisms yet means that you simply can’t get the security properties you want yet, instead of meaning that it’s ok to worsen the DX of ESM users in the meantime.

@mcollina
Copy link
Member

@guybedford I don't think that decrease is acceptable. We work a lot to bring up perf there, and I'm not sure we should be decreasing it.

@mcollina
Copy link
Member

@nodejs/tsc what do you think?

@bmeck
Copy link
Member

bmeck commented Jul 31, 2019

I'm going to be spending some time profiling what is going on. I don't see code related to this in inspector profiles or --prof that would make the time difference make sense. I'm wondering if something odd is happening and will have to dig into opts/deopts a bit. The only other alternative for what is causing stuff is the context wrapper but I would have to talk to V8 about why it isn't being optimized away which might take time.

Prof with PR:
$ node --prof-process with.log
Statistical profiling result from with.log, (4502 ticks, 1408 unaccounted, 0 excluded).

 [Shared libraries]:
   ticks  total  nonlib   name
     10    0.2%          /usr/lib/system/libsystem_pthread.dylib
      8    0.2%          /usr/lib/system/libsystem_platform.dylib
      3    0.1%          /usr/lib/system/libsystem_malloc.dylib

 [JavaScript]:
   ticks  total  nonlib   name
     65    1.4%    1.5%  LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
     51    1.1%    1.1%  LazyCompile: *onwrite _stream_writable.js:445:17
     46    1.0%    1.0%  LazyCompile: *resOnFinish _http_server.js:617:21
     45    1.0%    1.0%  LazyCompile: *clearBuffer _stream_writable.js:498:21
     44    1.0%    1.0%  LazyCompile: *assignSocket _http_server.js:203:62
     34    0.8%    0.8%  LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     27    0.6%    0.6%  LazyCompile: *parserOnIncoming _http_server.js:662:26
     26    0.6%    0.6%  LazyCompile: *Readable.read _stream_readable.js:400:35
     23    0.5%    0.5%  LazyCompile: *write_ _http_outgoing.js:564:16
     23    0.5%    0.5%  LazyCompile: *socketListenerWrap _http_server.js:780:37
     22    0.5%    0.5%  LazyCompile: *emitReadable_ _stream_readable.js:560:23
     20    0.4%    0.4%  LazyCompile: *nextTick internal/process/task_queues.js:109:18
     17    0.4%    0.4%  LazyCompile: *_storeHeader _http_outgoing.js:285:22
     16    0.4%    0.4%  LazyCompile: *readableAddChunk _stream_readable.js:224:26
     16    0.4%    0.4%  LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     16    0.4%    0.4%  LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     15    0.3%    0.3%  LazyCompile: *setHeader _http_outgoing.js:462:57
     14    0.3%    0.3%  LazyCompile: *resume_ _stream_readable.js:920:17
     13    0.3%    0.3%  LazyCompile: *_finish _http_server.js:169:52
     13    0.3%    0.3%  LazyCompile: *ReadableState _stream_readable.js:72:23
     13    0.3%    0.3%  LazyCompile: *<anonymous> internal/util/debuglog.js:57:18
     12    0.3%    0.3%  LazyCompile: *Readable.removeAllListeners _stream_readable.js:861:49
     11    0.2%    0.2%  LazyCompile: *debug internal/util/debuglog.js:45:35
     10    0.2%    0.2%  RegExp: [^\t\x20-\x7e\x80-\xff]
     10    0.2%    0.2%  LazyCompile: *resetHeadersTimeoutOnReqEnd _http_server.js:796:37
     10    0.2%    0.2%  LazyCompile: *endReadableNT _stream_readable.js:1124:23
     10    0.2%    0.2%  LazyCompile: *Writable.uncork _stream_writable.js:311:37
      9    0.2%    0.2%  LazyCompile: *parserOnMessageComplete _http_common.js:135:33
      8    0.2%    0.2%  LazyCompile: *ServerResponse _http_server.js:145:24
      7    0.2%    0.2%  RegExp: ^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$
      7    0.2%    0.2%  LazyCompile: *setStreamTimeout internal/stream_base_commons.js:202:26
      7    0.2%    0.2%  LazyCompile: *onFinish _http_outgoing.js:657:18
      6    0.1%    0.1%  LazyCompile: *matchKnownFields _http_incoming.js:139:26
      5    0.1%    0.1%  LazyCompile: *updateOutgoingData _http_server.js:445:28
      5    0.1%    0.1%  LazyCompile: *removeListener events.js:320:28
      5    0.1%    0.1%  LazyCompile: *emit events.js:153:44
      4    0.1%    0.1%  LazyCompile: *byteLength buffer.js:488:20
      4    0.1%    0.1%  LazyCompile: *Readable.on _stream_readable.js:815:33
      3    0.1%    0.1%  LazyCompile: *removeAllListeners events.js:376:32
      3    0.1%    0.1%  LazyCompile: *nop _stream_writable.js:54:13
      3    0.1%    0.1%  LazyCompile: *Writable.write _stream_writable.js:275:36
      2    0.0%    0.0%  LazyCompile: *unenroll timers.js:62:18
      2    0.0%    0.0%  LazyCompile: *onParserExecute _http_server.js:525:25
      2    0.0%    0.0%  LazyCompile: *afterWrite _stream_writable.js:479:20
      2    0.0%    0.0%  LazyCompile: *_unrefTimer net.js:344:52
      1    0.0%    0.0%  LazyCompile: *writeHead _http_server.js:234:19
      1    0.0%    0.0%  LazyCompile: *insert internal/timers.js:305:16
      1    0.0%    0.0%  LazyCompile: *emitCloseNT _http_server.js:655:21
      1    0.0%    0.0%  LazyCompile: *append internal/linkedlist.js:29:16
      1    0.0%    0.0%  LazyCompile: *_send _http_outgoing.js:222:49
      1    0.0%    0.0%  LazyCompile: *Writable.cork _stream_writable.js:307:35

 [C++]:
   ticks  total  nonlib   name
   1606   35.7%   35.8%  T __ZN2v88internal10ClassScope28GetUnresolvedPrivateNameTailEv
     46    1.0%    1.0%  t _szone_malloc_should_clear
     43    1.0%    1.0%  T __ZN2v86Object3GetENS_5LocalINS_7ContextEEEj
     37    0.8%    0.8%  T node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&)
     30    0.7%    0.7%  T void node::StreamBase::JSMethod<&(node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&)
     30    0.7%    0.7%  T node::native_module::NativeModuleEnv::CompileFunction(v8::FunctionCallbackInfo<v8::Value> const&)
     28    0.6%    0.6%  T __ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii
     26    0.6%    0.6%  T _munmap
     19    0.4%    0.4%  T ___mach_stack_logging_enumerate_records
     16    0.4%    0.4%  t __ZN2v812_GLOBAL__N_114CallDepthScopeILb0EEC1EPNS_8internal7IsolateENS_5LocalINS_7ContextEEE
     16    0.4%    0.4%  T __ZN2v88Function4CallENS_5LocalINS_7ContextEEENS1_INS_5ValueEEEiPS5_
     15    0.3%    0.3%  t node::LibuvStreamWrap::Initialize(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)::$_0::__invoke(v8::FunctionCallbackInfo<v8::Value> const&)
     15    0.3%    0.3%  T __ZN2v811HandleScope10InitializeEPNS_7IsolateE
     14    0.3%    0.3%  T ___malloc_init
     12    0.3%    0.3%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(), &(node::(anonymous namespace)::Parser::on_headers_complete())>::Raw(llhttp__internal_s*)
     12    0.3%    0.3%  t __ZN2v88internal6String7FlattenEPNS0_7IsolateENS0_6HandleIS1_EENS0_14AllocationTypeE
     12    0.3%    0.3%  T node::ParseEncoding(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
     11    0.2%    0.2%  t _update_cache_for_file_streams
     11    0.2%    0.2%  t _small_free_list_remove_ptr_no_clear
     11    0.2%    0.2%  T _vm_region_recurse_64
     10    0.2%    0.2%  t __enlarge
     10    0.2%    0.2%  T node::StringBytes::StorageSize(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
      9    0.2%    0.2%  t node::StreamBase::Write(uv_buf_t*, unsigned long, uv_stream_s*, v8::Local<v8::Object>)
      9    0.2%    0.2%  T node::InternalCallbackScope::Close()
      8    0.2%    0.2%  t __os_nospin_lock_unlock_slow
      8    0.2%    0.2%  T node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context)
      8    0.2%    0.2%  T __simple_dprintf
      8    0.2%    0.2%  T ___channel_get_opt
      8    0.2%    0.2%  T __ZNK2v85Value8ToStringENS_5LocalINS_7ContextEEE
      7    0.2%    0.2%  t node::(anonymous namespace)::StringPtr::Reset()
      7    0.2%    0.2%  T ___carbon_delete
      6    0.1%    0.1%  T node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*)
      6    0.1%    0.1%  T node::AsyncWrap::EmitTraceEventAfter(node::AsyncWrap::ProviderType, double)
      6    0.1%    0.1%  T __ZN2v87Isolate17GetCurrentContextEv
      6    0.1%    0.1%  T __ZN2v87Integer15NewFromUnsignedEPNS_7IsolateEj
      6    0.1%    0.1%  T __ZN2v87Context29GetNumberOfEmbedderDataFieldsEv
      6    0.1%    0.1%  T __ZN2v86String14NewFromOneByteEPNS_7IsolateEPKhNS_13NewStringTypeEi
      5    0.1%    0.1%  t node::NodeArrayBufferAllocator::Free(void*, unsigned long)
      5    0.1%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::AllocateSufficientStorage(unsigned long)
      5    0.1%    0.1%  t node::AsyncHooks::pop_async_id(double)
      5    0.1%    0.1%  T node::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
      5    0.1%    0.1%  T node::ParseEncoding(char const*, node::encoding)
      5    0.1%    0.1%  T node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
      5    0.1%    0.1%  T node::Environment::GetNow()
      5    0.1%    0.1%  T node::Emit(node::Environment*, double, node::AsyncHooks::Fields, v8::Local<v8::Function>)
      5    0.1%    0.1%  T node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*)
      5    0.1%    0.1%  T _free
      5    0.1%    0.1%  T __ZNK2v86String12WriteOneByteEPNS_7IsolateEPhiii
      5    0.1%    0.1%  T __ZNK2v85Value10IsFunctionEv
      4    0.1%    0.1%  t node::MaybeStackBuffer<uv_buf_t, 16ul>::AllocateSufficientStorage(unsigned long)
      4    0.1%    0.1%  t node::Buffer::(anonymous namespace)::ByteLengthUtf8(v8::FunctionCallbackInfo<v8::Value> const&)
      4    0.1%    0.1%  t node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)
      4    0.1%    0.1%  t _free_small
      4    0.1%    0.1%  t _allocate_pages_securely
      4    0.1%    0.1%  t _allocate_pages
      4    0.1%    0.1%  t __ZN2v88internal12_GLOBAL__N_124ProbeInstantiationsCacheEPNS0_7IsolateEiNS1_11CachingModeE
      4    0.1%    0.1%  t __ZN2v88internal12_GLOBAL__N_117InstantiateObjectEPNS0_7IsolateENS0_6HandleINS0_18ObjectTemplateInfoEEENS4_INS0_10JSReceiverEEEbb
      4    0.1%    0.1%  t __ZN2v812_GLOBAL__N_114CallDepthScopeILb1EEC1EPNS_8internal7IsolateENS_5LocalINS_7ContextEEE
      4    0.1%    0.1%  T node::DTRACE_HTTP_SERVER_RESPONSE(v8::FunctionCallbackInfo<v8::Value> const&)
      4    0.1%    0.1%  T node::DTRACE_HTTP_SERVER_REQUEST(v8::FunctionCallbackInfo<v8::Value> const&)
      4    0.1%    0.1%  T node::AsyncWrap::EmitTraceEventBefore()
      4    0.1%    0.1%  T __ZN2v85Array3NewEPNS_7IsolateEPNS_5LocalINS_5ValueEEEm
      4    0.1%    0.1%  T __ZN2v811HandleScopeD1Ev
      4    0.1%    0.1%  T __ZN2v811HandleScopeC1EPNS_7IsolateE
      3    0.1%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::SetLength(unsigned long)
      3    0.1%    0.1%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(), &(node::(anonymous namespace)::Parser::on_message_complete())>::Raw(llhttp__internal_s*)
      3    0.1%    0.1%  T non-virtual thunk to node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
      3    0.1%    0.1%  T node::TTYWrap::New(v8::FunctionCallbackInfo<v8::Value> const&)
      3    0.1%    0.1%  T node::InternalCallbackScope::InternalCallbackScope(node::Environment*, v8::Local<v8::Object>, node::async_context const&, node::InternalCallbackScope::ResourceExpectation)
      3    0.1%    0.1%  T node::Buffer::HasInstance(v8::Local<v8::Value>)
      3    0.1%    0.1%  T _mach_msg
      3    0.1%    0.1%  T __ZNK2v86String6LengthEv
      3    0.1%    0.1%  T __ZNK2v86String10Utf8LengthEPNS_7IsolateE
      3    0.1%    0.1%  T __ZNK2v85Value17IsArrayBufferViewEv
      3    0.1%    0.1%  T __ZNK2v85Array6LengthEv
      3    0.1%    0.1%  T __ZN2v88internal25FunctionCallbackArgumentsC1EPNS0_7IsolateENS0_6ObjectENS0_10HeapObjectES4_S5_Pmi
      3    0.1%    0.1%  T __ZN2v87Isolate9InContextEv
      2    0.0%    0.0%  t node::LibuvStreamWrap::ReadStart()::$_2::__invoke(uv_stream_s*, long, uv_buf_t const*)
      2    0.0%    0.0%  t node::(anonymous namespace)::StringPtr::Update(char const*, unsigned long)
      2    0.0%    0.0%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(char const*, unsigned long), &(node::(anonymous namespace)::Parser::on_url(char const*, unsigned long))>::Raw(llhttp__internal_s*, char const*, unsigned long)
      2    0.0%    0.0%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(char const*, unsigned long), &(node::(anonymous namespace)::Parser::on_header_field(char const*, unsigned long))>::Raw(llhttp__internal_s*, char const*, unsigned long)
      2    0.0%    0.0%  t node::(anonymous namespace)::Parser::Execute(char const*, unsigned long)
      2    0.0%    0.0%  t __read_images
      2    0.0%    0.0%  t __os_nospin_lock_lock_slow
      2    0.0%    0.0%  t __malloc_initialize
      2    0.0%    0.0%  T node::binding::GetInternalBinding(v8::FunctionCallbackInfo<v8::Value> const&)
      2    0.0%    0.0%  T node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*)
      2    0.0%    0.0%  T node::LibuvStreamWrap::OnUvAlloc(unsigned long, uv_buf_t*)
      2    0.0%    0.0%  T _mach_vm_purgable_control
      2    0.0%    0.0%  T __ZN2v87Isolate10GetCurrentEv
      2    0.0%    0.0%  T __ZN2v87Integer3NewEPNS_7IsolateEi
      2    0.0%    0.0%  T __ZN2v87Context5EnterEv
      1    0.0%    0.0%  t std::__1::__function::__func<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::'lambda'(), std::__1::allocator<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::'lambda'()>, void ()>::operator()()
      1    0.0%    0.0%  t non-virtual thunk to node::(anonymous namespace)::Parser::OnStreamAlloc(unsigned long)
      1    0.0%    0.0%  t node::fs::Read(v8::FunctionCallbackInfo<v8::Value> const&)
      1    0.0%    0.0%  t node::NodeArrayBufferAllocator::AllocateUninitialized(unsigned long)
      1    0.0%    0.0%  t node::MaybeStackBuffer<char, 1024ul>::SetLengthAndZeroTerminate(unsigned long)
      1    0.0%    0.0%  t node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_handle_s*, unsigned long, uv_buf_t*)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(char const*, unsigned long), &(node::(anonymous namespace)::Parser::on_header_value(char const*, unsigned long))>::Raw(llhttp__internal_s*, char const*, unsigned long)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(), &(node::(anonymous namespace)::Parser::on_message_begin())>::Raw(llhttp__internal_s*)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::New(v8::FunctionCallbackInfo<v8::Value> const&)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::MaybePause()
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::CreateHeaders()
      1    0.0%    0.0%  t _unwind_stack_from_table_index
      1    0.0%    0.0%  t _insert_node
      1    0.0%    0.0%  t __cxxabiv1::do_free(void*)
      1    0.0%    0.0%  t ___vfprintf
      1    0.0%    0.0%  t __ZNSt3__16vectorIdNS_9allocatorIdEEE21__push_back_slow_pathIRKdEEvOT_
      1    0.0%    0.0%  t __ZN2v88internal22HandleScopeImplementer12EnterContextENS0_7ContextE
      1    0.0%    0.0%  t __ZN2v88internal14LookupIterator17PropertyOrElementEPNS0_7IsolateENS0_6HandleINS0_6ObjectEEENS4_INS0_4NameEEENS4_INS0_10JSReceiverEEENS1_13ConfigurationE
      1    0.0%    0.0%  t __ZN2v84base19TemplateHashMapImplIPvS2_NS0_26HashEqualityThenKeyMatcherIS2_PFbS2_S2_EEENS0_23DefaultAllocationPolicyEE14LookupOrInsertIZNS8_14LookupOrInsertERKS2_jS7_EUlvE_EEPNS0_20TemplateHashMapEntryIS2_S2_EESB_jRKT_S7_
      1    0.0%    0.0%  T non-virtual thunk to node::LibuvStreamWrap::GetAsyncWrap()
      1    0.0%    0.0%  T node::TCPWrap::Bind6(v8::FunctionCallbackInfo<v8::Value> const&)
      1    0.0%    0.0%  T node::NodePlatform::CallOnWorkerThread(std::__1::unique_ptr<v8::Task, std::__1::default_delete<v8::Task> >)
      1    0.0%    0.0%  T node::AsyncWrap::EmitAfter(node::Environment*, double)
      1    0.0%    0.0%  T _malloc
      1    0.0%    0.0%  T _mach_vm_allocate
      1    0.0%    0.0%  T _mach_msg_server_once
      1    0.0%    0.0%  T __os_nospin_lock_unlock
      1    0.0%    0.0%  T __ZNK2v88internal12RootIndexMap6LookupEmPNS0_9RootIndexE
      1    0.0%    0.0%  T __ZNK2v86String17IsExternalOneByteEv
      1    0.0%    0.0%  T __ZNK2v85Value6IsTrueEv
      1    0.0%    0.0%  T __ZNK2v85Value12IntegerValueENS_5LocalINS_7ContextEEE
      1    0.0%    0.0%  T __ZN2v88internal21PerIsolateAssertScopeILNS0_20PerIsolateAssertTypeE0ELb1EE9IsAllowedEPNS0_7IsolateE
      1    0.0%    0.0%  T __ZN2v88internal10ApiNatives17InstantiateObjectEPNS0_7IsolateENS0_6HandleINS0_18ObjectTemplateInfoEEENS4_INS0_10JSReceiverEEE
      1    0.0%    0.0%  T __ZN2v86Object32SetAlignedPointerInInternalFieldEiPv

 [Summary]:
   ticks  total  nonlib   name
    712   15.8%   15.9%  JavaScript
   2361   52.4%   52.7%  C++
     54    1.2%    1.2%  GC
     21    0.5%          Shared libraries
   1408   31.3%          Unaccounted

 [C++ entry points]:
   ticks    cpp   total   name
   1465   79.1%   32.5%  T __ZN2v88internal10ClassScope28GetUnresolvedPrivateNameTailEv
     37    2.0%    0.8%  T node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&)
     35    1.9%    0.8%  t _szone_malloc_should_clear
     34    1.8%    0.8%  T __ZN2v86Object3GetENS_5LocalINS_7ContextEEEj
     28    1.5%    0.6%  T __ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii
     14    0.8%    0.3%  T ___mach_stack_logging_enumerate_records
     12    0.6%    0.3%  t __ZN2v812_GLOBAL__N_114CallDepthScopeILb0EEC1EPNS_8internal7IsolateENS_5LocalINS_7ContextEEE
     12    0.6%    0.3%  T void node::StreamBase::JSMethod<&(node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&)
     12    0.6%    0.3%  T node::ParseEncoding(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
     12    0.6%    0.3%  T ___malloc_init
     10    0.5%    0.2%  T node::StringBytes::StorageSize(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
     10    0.5%    0.2%  T _vm_region_recurse_64
      9    0.5%    0.2%  t node::StreamBase::Write(uv_buf_t*, unsigned long, uv_stream_s*, v8::Local<v8::Object>)
      9    0.5%    0.2%  t _update_cache_for_file_streams
      8    0.4%    0.2%  T __ZNK2v85Value8ToStringENS_5LocalINS_7ContextEEE
      7    0.4%    0.2%  t __enlarge
      7    0.4%    0.2%  T __simple_dprintf
      7    0.4%    0.2%  T __ZN2v811HandleScope10InitializeEPNS_7IsolateE
      6    0.3%    0.1%  t _small_free_list_remove_ptr_no_clear
      6    0.3%    0.1%  T node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*)
      5    0.3%    0.1%  t node::NodeArrayBufferAllocator::Free(void*, unsigned long)
      5    0.3%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::AllocateSufficientStorage(unsigned long)
      5    0.3%    0.1%  T node::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
      5    0.3%    0.1%  T node::ParseEncoding(char const*, node::encoding)
      5    0.3%    0.1%  T node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
      5    0.3%    0.1%  T node::Environment::GetNow()
      5    0.3%    0.1%  T _free
      5    0.3%    0.1%  T __ZNK2v86String12WriteOneByteEPNS_7IsolateEPhiii
      5    0.3%    0.1%  T __ZN2v87Integer15NewFromUnsignedEPNS_7IsolateEj
      4    0.2%    0.1%  t node::MaybeStackBuffer<uv_buf_t, 16ul>::AllocateSufficientStorage(unsigned long)
      4    0.2%    0.1%  t _free_small
      4    0.2%    0.1%  t _allocate_pages_securely
      4    0.2%    0.1%  t _allocate_pages
      4    0.2%    0.1%  T node::DTRACE_HTTP_SERVER_RESPONSE(v8::FunctionCallbackInfo<v8::Value> const&)
      4    0.2%    0.1%  T node::DTRACE_HTTP_SERVER_REQUEST(v8::FunctionCallbackInfo<v8::Value> const&)
      3    0.2%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::SetLength(unsigned long)
      3    0.2%    0.1%  T non-virtual thunk to node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
      3    0.2%    0.1%  T node::Buffer::HasInstance(v8::Local<v8::Value>)
      3    0.2%    0.1%  T __ZNK2v86String6LengthEv
      3    0.2%    0.1%  T __ZNK2v86String10Utf8LengthEPNS_7IsolateE
      3    0.2%    0.1%  T __ZNK2v85Value17IsArrayBufferViewEv
      3    0.2%    0.1%  T __ZNK2v85Array6LengthEv
      3    0.2%    0.1%  T __ZN2v87Isolate17GetCurrentContextEv
      3    0.2%    0.1%  T __ZN2v811HandleScopeD1Ev
      3    0.2%    0.1%  T __ZN2v811HandleScopeC1EPNS_7IsolateE
      2    0.1%    0.0%  t node::Buffer::(anonymous namespace)::ByteLengthUtf8(v8::FunctionCallbackInfo<v8::Value> const&)
      1    0.1%    0.0%  t node::NodeArrayBufferAllocator::AllocateUninitialized(unsigned long)
      1    0.1%    0.0%  t node::MaybeStackBuffer<char, 1024ul>::SetLengthAndZeroTerminate(unsigned long)
      1    0.1%    0.0%  t _unwind_stack_from_table_index
      1    0.1%    0.0%  t _insert_node
      1    0.1%    0.0%  t __malloc_initialize
      1    0.1%    0.0%  t __ZN2v88internal6String7FlattenEPNS0_7IsolateENS0_6HandleIS1_EENS0_14AllocationTypeE
      1    0.1%    0.0%  T non-virtual thunk to node::LibuvStreamWrap::GetAsyncWrap()
      1    0.1%    0.0%  T _malloc
      1    0.1%    0.0%  T __ZNK2v86String17IsExternalOneByteEv
      1    0.1%    0.0%  T __ZNK2v85Value6IsTrueEv

 [Bottom up (heavy) profile]:
  Note: percentage shows a share of a particular caller in the total
  amount of its parent calls.
  Callers occupying less than 1.0% are not shown.

   ticks parent  name
   1606   35.7%  T __ZN2v88internal10ClassScope28GetUnresolvedPrivateNameTailEv
    318   19.8%    T __ZN2v88internal10ClassScope28GetUnresolvedPrivateNameTailEv
    116   36.5%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
    115   99.1%        LazyCompile: *parserOnIncoming _http_server.js:662:26
    115  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     42   13.2%      LazyCompile: *_storeHeader _http_outgoing.js:285:22
     41   97.6%        LazyCompile: *write_ _http_outgoing.js:564:16
     41  100.0%          LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     40   97.6%            LazyCompile: *parserOnIncoming _http_server.js:662:26
      1    2.4%            LazyCompile: *emit events.js:153:44
      1    2.4%        LazyCompile: *writeHead _http_server.js:234:19
      1  100.0%          LazyCompile: ~_implicitHeader _http_server.js:229:68
      1  100.0%            LazyCompile: ~write_ _http_outgoing.js:564:16
     35   11.0%      LazyCompile: *Readable.read _stream_readable.js:400:35
     26   74.3%        LazyCompile: *resume_ _stream_readable.js:920:17
     26  100.0%          LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      8   22.9%        LazyCompile: *emitReadable_ _stream_readable.js:560:23
      8  100.0%          LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      1    2.9%        LazyCompile: *flow _stream_readable.js:944:14
      1  100.0%          LazyCompile: ~resume_ _stream_readable.js:920:17
      1  100.0%            LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
     32   10.1%      LazyCompile: *clearBuffer _stream_writable.js:498:21
     32  100.0%        LazyCompile: *assignSocket _http_server.js:203:62
     31   96.9%          LazyCompile: *resOnFinish _http_server.js:617:21
     28   90.3%            LazyCompile: *onFinish _http_outgoing.js:657:18
      3    9.7%            LazyCompile: *emit events.js:153:44
      1    3.1%          LazyCompile: ~resOnFinish _http_server.js:617:21
      1  100.0%            LazyCompile: *emit events.js:153:44
      6    1.9%      LazyCompile: ~emitBeforeScript internal/async_hooks.js:345:26
      6  100.0%        LazyCompile: ~processTicksAndRejections internal/process/task_queues.js:65:35
      4    1.3%      LazyCompile: ~parserOnIncoming _http_server.js:662:26
      3   75.0%        LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      1   25.0%        LazyCompile: ~parserOnHeadersComplete _http_common.js:71:33
      4    1.3%      LazyCompile: ~<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      3   75.0%        LazyCompile: ~emit events.js:153:44
      3  100.0%          LazyCompile: ~parserOnIncoming _http_server.js:662:26
      3  100.0%            LazyCompile: ~parserOnHeadersComplete _http_common.js:71:33
      1   25.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
      1  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      4    1.3%      LazyCompile: *parserOnIncoming _http_server.js:662:26
      4  100.0%        LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
    222   13.8%    LazyCompile: *clearBuffer _stream_writable.js:498:21
    221   99.5%      LazyCompile: *assignSocket _http_server.js:203:62
    221  100.0%        LazyCompile: *resOnFinish _http_server.js:617:21
    217   98.2%          LazyCompile: *onFinish _http_outgoing.js:657:18
    217  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      4    1.8%          LazyCompile: *emit events.js:153:44
      4  100.0%            LazyCompile: ~onFinish _http_outgoing.js:657:18
    100    6.2%    LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     58    3.6%    LazyCompile: *assignSocket _http_server.js:203:62
     58  100.0%      LazyCompile: *resOnFinish _http_server.js:617:21
     55   94.8%        LazyCompile: *onFinish _http_outgoing.js:657:18
     55  100.0%          LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     55  100.0%            LazyCompile: *afterWrite _stream_writable.js:479:20
      3    5.2%        LazyCompile: *emit events.js:153:44
      3  100.0%          LazyCompile: ~onFinish _http_outgoing.js:657:18
      3  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     47    2.9%    LazyCompile: *parserOnIncoming _http_server.js:662:26
     47  100.0%      LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     43    2.7%    LazyCompile: *resOnFinish _http_server.js:617:21
     40   93.0%      LazyCompile: *onFinish _http_outgoing.js:657:18
     40  100.0%        LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     40  100.0%          LazyCompile: *afterWrite _stream_writable.js:479:20
     40  100.0%            LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      3    7.0%      LazyCompile: *emit events.js:153:44
      3  100.0%        LazyCompile: ~onFinish _http_outgoing.js:657:18
      3  100.0%          LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      3  100.0%            LazyCompile: *afterWrite _stream_writable.js:479:20
     37    2.3%    LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     36   97.3%      LazyCompile: *parserOnIncoming _http_server.js:662:26
     36  100.0%        LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      1    2.7%      LazyCompile: *emit events.js:153:44
      1  100.0%        LazyCompile: ~parserOnIncoming _http_server.js:662:26
      1  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     31    1.9%    LazyCompile: *write_ _http_outgoing.js:564:16
     31  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     30   96.8%        LazyCompile: *parserOnIncoming _http_server.js:662:26
     30  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      1    3.2%        LazyCompile: *emit events.js:153:44
      1  100.0%          LazyCompile: ~parserOnIncoming _http_server.js:662:26
      1  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     28    1.7%    LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
     21    1.3%    LazyCompile: *resume_ _stream_readable.js:920:17
     21  100.0%      LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
     17    1.1%    LazyCompile: *setHeader _http_outgoing.js:462:57
     17  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     16   94.1%        LazyCompile: *parserOnIncoming _http_server.js:662:26
     16  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      1    5.9%        LazyCompile: *emit events.js:153:44
      1  100.0%          LazyCompile: ~parserOnIncoming _http_server.js:662:26
      1  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33

   1408   31.3%  UNKNOWN
   1187   84.3%    LazyCompile: *clearBuffer _stream_writable.js:498:21
   1184   99.7%      LazyCompile: *assignSocket _http_server.js:203:62
   1184  100.0%        LazyCompile: *resOnFinish _http_server.js:617:21
   1149   97.0%          LazyCompile: *onFinish _http_outgoing.js:657:18
   1149  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     35    3.0%          LazyCompile: *emit events.js:153:44
     35  100.0%            LazyCompile: ~onFinish _http_outgoing.js:657:18
    123    8.7%    LazyCompile: *Writable.uncork _stream_writable.js:311:37
    123  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
    121   98.4%        LazyCompile: *parserOnIncoming _http_server.js:662:26
    121  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      2    1.6%        LazyCompile: *emit events.js:153:44
      2  100.0%          LazyCompile: ~parserOnIncoming _http_server.js:662:26
      2  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33

     65    1.4%  LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35

     51    1.1%  LazyCompile: *onwrite _stream_writable.js:445:17
     40   78.4%    LazyCompile: *clearBuffer _stream_writable.js:498:21
     40  100.0%      LazyCompile: *assignSocket _http_server.js:203:62
     40  100.0%        LazyCompile: *resOnFinish _http_server.js:617:21
     38   95.0%          LazyCompile: *onFinish _http_outgoing.js:657:18
     38  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      2    5.0%          LazyCompile: *emit events.js:153:44
      2  100.0%            LazyCompile: ~onFinish _http_outgoing.js:657:18
      7   13.7%    LazyCompile: *assignSocket _http_server.js:203:62
      7  100.0%      LazyCompile: *resOnFinish _http_server.js:617:21
      6   85.7%        LazyCompile: *onFinish _http_outgoing.js:657:18
      6  100.0%          LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      6  100.0%            LazyCompile: *afterWrite _stream_writable.js:479:20
      1   14.3%        LazyCompile: *emit events.js:153:44
      1  100.0%          LazyCompile: ~onFinish _http_outgoing.js:657:18
      1  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      3    5.9%    LazyCompile: *afterWriteDispatched internal/stream_base_commons.js:141:30
      3  100.0%      LazyCompile: *Writable.uncork _stream_writable.js:311:37
      3  100.0%        LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      3  100.0%          LazyCompile: *parserOnIncoming _http_server.js:662:26
      3  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      1    2.0%    LazyCompile: *Writable.uncork _stream_writable.js:311:37
      1  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      1  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
      1  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33

     46    1.0%  t _szone_malloc_should_clear
     32   69.6%    LazyCompile: *clearBuffer _stream_writable.js:498:21
     32  100.0%      LazyCompile: *assignSocket _http_server.js:203:62
     32  100.0%        LazyCompile: *resOnFinish _http_server.js:617:21
     30   93.8%          LazyCompile: *onFinish _http_outgoing.js:657:18
     30  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      2    6.3%          LazyCompile: *emit events.js:153:44
      2  100.0%            LazyCompile: ~onFinish _http_outgoing.js:657:18
      8   17.4%    T __ZN2v88internal10ClassScope28GetUnresolvedPrivateNameTailEv
      7   87.5%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      6   85.7%        LazyCompile: *parserOnIncoming _http_server.js:662:26
      6  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      1   14.3%        LazyCompile: ~emit events.js:153:44
      1  100.0%          LazyCompile: ~parserOnIncoming _http_server.js:662:26
      1  100.0%            LazyCompile: ~parserOnHeadersComplete _http_common.js:71:33
      1   12.5%      LazyCompile: ~errnoException internal/errors.js:446:24
      1  100.0%        LazyCompile: ~afterWriteDispatched internal/stream_base_commons.js:141:30
      1  100.0%          LazyCompile: ~writevGeneric internal/stream_base_commons.js:107:23
      1  100.0%            LazyCompile: ~Socket._writeGeneric net.js:672:42
      3    6.5%    LazyCompile: *Writable.uncork _stream_writable.js:311:37
      3  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      3  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
      3  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33

     46    1.0%  LazyCompile: *resOnFinish _http_server.js:617:21
     42   91.3%    LazyCompile: *onFinish _http_outgoing.js:657:18
     42  100.0%      LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     42  100.0%        LazyCompile: *afterWrite _stream_writable.js:479:20
     42  100.0%          LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      3    6.5%    LazyCompile: *emit events.js:153:44
      3  100.0%      LazyCompile: ~onFinish _http_outgoing.js:657:18
      3  100.0%        LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      3  100.0%          LazyCompile: *afterWrite _stream_writable.js:479:20
      3  100.0%            LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      1    2.2%    LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      1  100.0%      LazyCompile: *afterWrite _stream_writable.js:479:20
      1  100.0%        LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
Prof without PR:
$ node --prof-process without.log
Code move event for unknown code: 0x75c6bc4ab0
Code move event for unknown code: 0x75c36ebd00
Code move event for unknown code: 0x75c36ebf58
Code move event for unknown code: 0x75c6bc7fc8
Code move event for unknown code: 0x75c36ec648
Code move event for unknown code: 0x75c6bc8190
Code move event for unknown code: 0x75c36f8f28
Code move event for unknown code: 0x75c36f9188
Code move event for unknown code: 0x75a1ad2b98
Code move event for unknown code: 0x75c6bccd40
Code move event for unknown code: 0x75c6bcd318
Code move event for unknown code: 0x75c6bcd930
Code move event for unknown code: 0x75c6bce3e0
Code move event for unknown code: 0x75c6bce570
Code move event for unknown code: 0x75a1ad63c8
Code move event for unknown code: 0x75a1ad6770
Code move event for unknown code: 0x75a1ad6c78
Code move event for unknown code: 0x75a1adbdf0
Code move event for unknown code: 0x75a1adc618
Code move event for unknown code: 0x75a1adc8c8
Code move event for unknown code: 0x75a1adcff0
Code move event for unknown code: 0x75a1addba0
Code move event for unknown code: 0x75a1ade5d0
Code move event for unknown code: 0x75a1ade8f8
Code move event for unknown code: 0x75a1adea98
Code move event for unknown code: 0x75a1adec00
Code move event for unknown code: 0x75a1aded58
Code move event for unknown code: 0x75a1adf0f0
Code move event for unknown code: 0x7552b517b0
Code move event for unknown code: 0x7552b51f58
Code move event for unknown code: 0x7552b526c0
Code move event for unknown code: 0x7552b53910
Code move event for unknown code: 0x7552b53a80
Code move event for unknown code: 0x7552b53da0
Code move event for unknown code: 0x7552b540f0
Code move event for unknown code: 0x7552b547d8
Code move event for unknown code: 0x7552b54f30
Code move event for unknown code: 0x7552b55240
Code move event for unknown code: 0x7552b557a0
Code move event for unknown code: 0x7552b55a60
Code move event for unknown code: 0x7552b55d98
Code move event for unknown code: 0x7552b55f68
Code move event for unknown code: 0x7552b565d0
Code move event for unknown code: 0x7552b56a08
Code move event for unknown code: 0x7552b57490
Code move event for unknown code: 0x7552b57688
Code move event for unknown code: 0x7552b577c0
Code move event for unknown code: 0x7552b57b28
Code move event for unknown code: 0x7552b58740
Code move event for unknown code: 0x7552b58988
Code move event for unknown code: 0x7552b58b08
Code move event for unknown code: 0x7552b58cc8
Code move event for unknown code: 0x7552b58ec0
Code move event for unknown code: 0x7552b590a8
Code move event for unknown code: 0x7552b592b8
Code move event for unknown code: 0x7552b59460
Code move event for unknown code: 0x7552b59678
Code move event for unknown code: 0x7552b59848
Code move event for unknown code: 0x7552b59a50
Code move event for unknown code: 0x7552b59dd0
Code move event for unknown code: 0x7552b5a008
Code move event for unknown code: 0x7552b5a220
Code move event for unknown code: 0x7552b5a508
Code move event for unknown code: 0x7552b5a810
Code move event for unknown code: 0x7552b5ac10
Code move event for unknown code: 0x7552b5b0a0
Code move event for unknown code: 0x7552b5b2b8
Code move event for unknown code: 0x7552b5b710
Code move event for unknown code: 0x7552b5b9a0
Code move event for unknown code: 0x7552b5bed8
Code move event for unknown code: 0x7552b5c100
Code move event for unknown code: 0x7552b5c730
Code move event for unknown code: 0x7552b5c8a8
Code move event for unknown code: 0x7552b5c9f8
Code move event for unknown code: 0x7552b5cba8
Code move event for unknown code: 0x7552b5ce20
Code move event for unknown code: 0x7552b5d2b8
Code move event for unknown code: 0x7552b5d7d8
Code move event for unknown code: 0x7552b5da70
Code move event for unknown code: 0x7552b5dc90
Code move event for unknown code: 0x7552b5de98
Code move event for unknown code: 0x7552b5e018
Code move event for unknown code: 0x7552b5e1f8
Code move event for unknown code: 0x7552b5e468
Code move event for unknown code: 0x7552b5e5f8
Code move event for unknown code: 0x7552b5e860
Code move event for unknown code: 0x7552b5eb90
Code move event for unknown code: 0x7552b5ee50
Code move event for unknown code: 0x7552b5f790
Code move event for unknown code: 0x7552b5f9f0
Code move event for unknown code: 0x7552b5fba8
Code move event for unknown code: 0x7552b5ff58
Code move event for unknown code: 0x7552b60778
Code move event for unknown code: 0x7552b60e70
Code move event for unknown code: 0x7552b619c0
Code move event for unknown code: 0x7552b61d08
Code move event for unknown code: 0x7552b61ee0
Code move event for unknown code: 0x7552b62230
Code move event for unknown code: 0x75c6be90c0
Code move event for unknown code: 0x75c6be9230
Code move event for unknown code: 0x75c6be93f0
Code move event for unknown code: 0x75c6bebb60
Code move event for unknown code: 0x75c6bebd00
Code move event for unknown code: 0x75c6bebfe0
Code move event for unknown code: 0x75a1af0ff8
Code move event for unknown code: 0x75a1af1878
Code move event for unknown code: 0x75a1af1e28
Code move event for unknown code: 0x75a1af2500
Code move event for unknown code: 0x75c6bef1b8
Code move event for unknown code: 0x75a1af27a8
Code move event for unknown code: 0x75c6befa48
Code move event for unknown code: 0x75a1af2c80
Code move event for unknown code: 0x75c6bf0788
Code move event for unknown code: 0x75a1af2df0
Code move event for unknown code: 0x75c6bf0ac0
Code move event for unknown code: 0x75a1af2f50
Code move event for unknown code: 0x75c6bf0c20
Code move event for unknown code: 0x75a1af30e8
Code move event for unknown code: 0x75c6bf0e38
Code move event for unknown code: 0x75a1af3360
Code move event for unknown code: 0x75c6bf13b8
Code move event for unknown code: 0x75a1af34d8
Code move event for unknown code: 0x75c6bf15d0
Code move event for unknown code: 0x75a1af3660
Code move event for unknown code: 0x75c6bf17b8
Code move event for unknown code: 0x75a1af37d8
Code move event for unknown code: 0x75c6bf19d0
Code move event for unknown code: 0x75a1af3a10
Code move event for unknown code: 0x75c6bf1c28
Code move event for unknown code: 0x75a1af3ba8
Code move event for unknown code: 0x75c6bf1e90
Code move event for unknown code: 0x75a1af3de8
Code move event for unknown code: 0x75a1af4178
Code move event for unknown code: 0x75a1af4378
Code move event for unknown code: 0x75c6bf2758
Code move event for unknown code: 0x75a1af4650
Code move event for unknown code: 0x75c6bf2958
Code move event for unknown code: 0x75a1af4848
Code move event for unknown code: 0x75c6bf2d08
Code move event for unknown code: 0x75a1af4a88
Code move event for unknown code: 0x75c6bf3338
Code move event for unknown code: 0x75a1af4df0
Code move event for unknown code: 0x75c6bf3510
Code move event for unknown code: 0x75a1af4f80
Code move event for unknown code: 0x75c6bf3850
Code move event for unknown code: 0x75a1af50e8
Code move event for unknown code: 0x75c6bf3b18
Code move event for unknown code: 0x75a1af52d8
Code move event for unknown code: 0x75a1af57e8
Code move event for unknown code: 0x75a1af5dd8
Code move event for unknown code: 0x75c6bf3e68
Code move event for unknown code: 0x75c6bf41a8
Code move event for unknown code: 0x75c6bf4750
Code move event for unknown code: 0x75c6bf4ae0
Code move event for unknown code: 0x75c6bf4dc8
Code move event for unknown code: 0x75c6bf5058
Code move event for unknown code: 0x75c6bf52d0
Code move event for unknown code: 0x75c6bf55d0
Code move event for unknown code: 0x75c6bf5af0
Code move event for unknown code: 0x75c6bf6298
Code move event for unknown code: 0x75c6bf6a60
Code move event for unknown code: 0x75c6bf72c0
Code move event for unknown code: 0x75c6bf74b0
Code move event for unknown code: 0x7552b7f448
Statistical profiling result from without.log, (4455 ticks, 1311 unaccounted, 0 excluded).

 [Shared libraries]:
   ticks  total  nonlib   name
     19    0.4%          /usr/lib/system/libsystem_pthread.dylib
      8    0.2%          /usr/lib/system/libsystem_platform.dylib
      3    0.1%          /usr/lib/system/libsystem_malloc.dylib

 [JavaScript]:
   ticks  total  nonlib   name
     61    1.4%    1.4%  LazyCompile: *onwrite _stream_writable.js:445:17
     49    1.1%    1.1%  LazyCompile: *resOnFinish _http_server.js:617:21
     49    1.1%    1.1%  LazyCompile: *clearBuffer _stream_writable.js:498:21
     46    1.0%    1.0%  LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
     41    0.9%    0.9%  LazyCompile: *assignSocket _http_server.js:203:62
     40    0.9%    0.9%  LazyCompile: *Readable.read _stream_readable.js:400:35
     38    0.9%    0.9%  LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     30    0.7%    0.7%  LazyCompile: *write_ _http_outgoing.js:564:16
     25    0.6%    0.6%  LazyCompile: *parserOnIncoming _http_server.js:662:26
     24    0.5%    0.5%  LazyCompile: *socketListenerWrap _http_server.js:780:37
     23    0.5%    0.5%  LazyCompile: *_storeHeader _http_outgoing.js:285:22
     22    0.5%    0.5%  LazyCompile: *resetHeadersTimeoutOnReqEnd _http_server.js:796:37
     21    0.5%    0.5%  LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     19    0.4%    0.4%  LazyCompile: *resume_ _stream_readable.js:920:17
     17    0.4%    0.4%  LazyCompile: *setHeader _http_outgoing.js:462:57
     16    0.4%    0.4%  LazyCompile: *nextTick internal/process/task_queues.js:109:18
     16    0.4%    0.4%  LazyCompile: *endReadableNT _stream_readable.js:1124:23
     14    0.3%    0.3%  RegExp: [^\t\x20-\x7e\x80-\xff]
     14    0.3%    0.3%  LazyCompile: *readableAddChunk _stream_readable.js:224:26
     13    0.3%    0.3%  LazyCompile: *ReadableState _stream_readable.js:72:23
     12    0.3%    0.3%  LazyCompile: *<anonymous> internal/util/debuglog.js:57:18
     11    0.2%    0.2%  LazyCompile: *afterWrite _stream_writable.js:479:20
     10    0.2%    0.2%  LazyCompile: *_finish _http_server.js:169:52
      9    0.2%    0.2%  LazyCompile: *onFinish _http_outgoing.js:657:18
      9    0.2%    0.2%  LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      8    0.2%    0.2%  RegExp: ^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$
      8    0.2%    0.2%  LazyCompile: *parserOnMessageComplete _http_common.js:135:33
      7    0.2%    0.2%  LazyCompile: *updateOutgoingData _http_server.js:445:28
      7    0.2%    0.2%  LazyCompile: *matchKnownFields _http_incoming.js:139:26
      7    0.2%    0.2%  LazyCompile: *emit events.js:153:44
      6    0.1%    0.1%  LazyCompile: *Readable.on _stream_readable.js:815:33
      5    0.1%    0.1%  LazyCompile: *setStreamTimeout internal/stream_base_commons.js:202:26
      5    0.1%    0.1%  LazyCompile: *ServerResponse _http_server.js:145:24
      4    0.1%    0.1%  LazyCompile: *removeListener events.js:320:28
      4    0.1%    0.1%  LazyCompile: *emitReadable_ _stream_readable.js:560:23
      4    0.1%    0.1%  LazyCompile: *debug internal/util/debuglog.js:45:35
      4    0.1%    0.1%  LazyCompile: *byteLength buffer.js:488:20
      4    0.1%    0.1%  LazyCompile: *_unrefTimer net.js:344:52
      4    0.1%    0.1%  LazyCompile: *Writable.uncork _stream_writable.js:311:37
      3    0.1%    0.1%  LazyCompile: *insert internal/timers.js:305:16
      3    0.1%    0.1%  LazyCompile: *Readable.removeAllListeners _stream_readable.js:861:49
      2    0.0%    0.0%  LazyCompile: *removeAllListeners events.js:376:32
      2    0.0%    0.0%  LazyCompile: *nop _stream_writable.js:54:13
      2    0.0%    0.0%  LazyCompile: *emitCloseNT _http_server.js:655:21
      2    0.0%    0.0%  LazyCompile: *Writable.write _stream_writable.js:275:36
      1    0.0%    0.0%  LazyCompile: *writeHead _http_server.js:234:19
      1    0.0%    0.0%  LazyCompile: *unenroll timers.js:62:18
      1    0.0%    0.0%  LazyCompile: *remove internal/linkedlist.js:15:16
      1    0.0%    0.0%  LazyCompile: *onParserExecuteCommon _http_server.js:568:31
      1    0.0%    0.0%  LazyCompile: *onParserExecute _http_server.js:525:25
      1    0.0%    0.0%  LazyCompile: *afterWriteDispatched internal/stream_base_commons.js:141:30
      1    0.0%    0.0%  LazyCompile: *addListener events.js:276:58
      1    0.0%    0.0%  LazyCompile: *Writable.cork _stream_writable.js:307:35

 [C++]:
   ticks  total  nonlib   name
   1612   36.2%   36.4%  T __ZN2v88internal10ClassScope28ResolvePrivateNamesPartiallyEv
     46    1.0%    1.0%  t _szone_malloc_should_clear
     38    0.9%    0.9%  T __ZN2v86Object3GetENS_5LocalINS_7ContextEEEj
     32    0.7%    0.7%  T node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&)
     27    0.6%    0.6%  T void node::StreamBase::JSMethod<&(node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&)
     27    0.6%    0.6%  T __ZN2v88Function4CallENS_5LocalINS_7ContextEEENS1_INS_5ValueEEEiPS5_
     25    0.6%    0.6%  T _munmap
     24    0.5%    0.5%  T __ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii
     23    0.5%    0.5%  T _mach_msg
     20    0.4%    0.5%  T node::native_module::NativeModuleEnv::CompileFunction(v8::FunctionCallbackInfo<v8::Value> const&)
     16    0.4%    0.4%  t node::LibuvStreamWrap::Initialize(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)::$_0::__invoke(v8::FunctionCallbackInfo<v8::Value> const&)
     16    0.4%    0.4%  T ___channel_get_opt
     15    0.3%    0.3%  T ___mach_stack_logging_enumerate_records
     13    0.3%    0.3%  t __enlarge
     13    0.3%    0.3%  t __ZN2v88internal6String7FlattenEPNS0_7IsolateENS0_6HandleIS1_EENS0_14AllocationTypeE
     13    0.3%    0.3%  T _vm_region_recurse_64
     12    0.3%    0.3%  t node::StreamBase::Write(uv_buf_t*, unsigned long, uv_stream_s*, v8::Local<v8::Object>)
     12    0.3%    0.3%  T node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
     12    0.3%    0.3%  T __ZN2v87Isolate17GetCurrentContextEv
     12    0.3%    0.3%  T __ZN2v811HandleScope10InitializeEPNS_7IsolateE
     10    0.2%    0.2%  t __ZN2v812_GLOBAL__N_114CallDepthScopeILb0EEC1EPNS_8internal7IsolateENS_5LocalINS_7ContextEEE
      9    0.2%    0.2%  t node::NodeArrayBufferAllocator::Free(void*, unsigned long)
      9    0.2%    0.2%  T node::InternalCallbackScope::InternalCallbackScope(node::Environment*, v8::Local<v8::Object>, node::async_context const&, node::InternalCallbackScope::ResourceExpectation)
      9    0.2%    0.2%  T node::AsyncWrap::EmitTraceEventAfter(node::AsyncWrap::ProviderType, double)
      9    0.2%    0.2%  T _malloc
      9    0.2%    0.2%  T ___carbon_delete
      8    0.2%    0.2%  t _small_free_list_remove_ptr_no_clear
      8    0.2%    0.2%  t __cxxabiv1::do_free(void*)
      8    0.2%    0.2%  T node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*)
      8    0.2%    0.2%  T node::ParseEncoding(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
      8    0.2%    0.2%  T node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context)
      8    0.2%    0.2%  T node::Environment::GetNow()
      8    0.2%    0.2%  T __ZNK2v85Value10IsFunctionEv
      7    0.2%    0.2%  t node::(anonymous namespace)::StringPtr::Reset()
      7    0.2%    0.2%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(), &(node::(anonymous namespace)::Parser::on_headers_complete())>::Raw(llhttp__internal_s*)
      7    0.2%    0.2%  T node::StringBytes::StorageSize(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
      7    0.2%    0.2%  T node::InternalCallbackScope::Close()
      7    0.2%    0.2%  T __ZNK2v85Value8ToStringENS_5LocalINS_7ContextEEE
      7    0.2%    0.2%  T __ZN2v85Array3NewEPNS_7IsolateEPNS_5LocalINS_5ValueEEEm
      6    0.1%    0.1%  t __os_nospin_lock_unlock_slow
      6    0.1%    0.1%  T node::Emit(node::Environment*, double, node::AsyncHooks::Fields, v8::Local<v8::Function>)
      6    0.1%    0.1%  T _free
      6    0.1%    0.1%  T __ZNK2v86String10Utf8LengthEPNS_7IsolateE
      5    0.1%    0.1%  t _update_cache_for_file_streams
      5    0.1%    0.1%  t _allocate_pages_securely
      5    0.1%    0.1%  t __ZN2v812_GLOBAL__N_114CallDepthScopeILb1EEC1EPNS_8internal7IsolateENS_5LocalINS_7ContextEEE
      5    0.1%    0.1%  T non-virtual thunk to node::LibuvStreamWrap::IsAlive()
      5    0.1%    0.1%  T node::ParseEncoding(char const*, node::encoding)
      5    0.1%    0.1%  T node::DTRACE_HTTP_SERVER_REQUEST(v8::FunctionCallbackInfo<v8::Value> const&)
      5    0.1%    0.1%  T node::Buffer::HasInstance(v8::Local<v8::Value>)
      5    0.1%    0.1%  T node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*)
      5    0.1%    0.1%  T __ZNK2v86String6LengthEv
      5    0.1%    0.1%  T __ZNK2v85Value17IsArrayBufferViewEv
      5    0.1%    0.1%  T __ZN2v86String14NewFromOneByteEPNS_7IsolateEPKhNS_13NewStringTypeEi
      5    0.1%    0.1%  T __ZN2v811HandleScopeC1EPNS_7IsolateE
      4    0.1%    0.1%  t node::(anonymous namespace)::StringPtr::Update(char const*, unsigned long)
      4    0.1%    0.1%  t node::(anonymous namespace)::GetLibuvNow(v8::FunctionCallbackInfo<v8::Value> const&)
      4    0.1%    0.1%  T node::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
      4    0.1%    0.1%  T node::AsyncWrap::EmitTraceEventBefore()
      4    0.1%    0.1%  T _mprotect
      4    0.1%    0.1%  T __simple_dprintf
      4    0.1%    0.1%  T ___malloc_init
      4    0.1%    0.1%  T ___mach_stack_logging_uniquing_table_read_stack
      3    0.1%    0.1%  t std::__1::__function::__func<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::'lambda'(), std::__1::allocator<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::'lambda'()>, void ()>::operator()()
      3    0.1%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::SetLengthAndZeroTerminate(unsigned long)
      3    0.1%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::SetLength(unsigned long)
      3    0.1%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::AllocateSufficientStorage(unsigned long)
      3    0.1%    0.1%  t node::Buffer::(anonymous namespace)::ByteLengthUtf8(v8::FunctionCallbackInfo<v8::Value> const&)
      3    0.1%    0.1%  t node::AsyncHooks::pop_async_id(double)
      3    0.1%    0.1%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(char const*, unsigned long), &(node::(anonymous namespace)::Parser::on_url(char const*, unsigned long))>::Raw(llhttp__internal_s*, char const*, unsigned long)
      3    0.1%    0.1%  t __malloc_initialize
      3    0.1%    0.1%  T node::TTYWrap::New(v8::FunctionCallbackInfo<v8::Value> const&)
      3    0.1%    0.1%  T node::LibuvStreamWrap::OnUvAlloc(unsigned long, uv_buf_t*)
      3    0.1%    0.1%  T __ZN2v88internal25FunctionCallbackArgumentsC1EPNS0_7IsolateENS0_6ObjectENS0_10HeapObjectES4_S5_Pmi
      3    0.1%    0.1%  T __ZN2v87Integer3NewEPNS_7IsolateEi
      3    0.1%    0.1%  T __ZN2v811HandleScopeD1Ev
      2    0.0%    0.0%  t node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_handle_s*, unsigned long, uv_buf_t*)
      2    0.0%    0.0%  t node::(anonymous namespace)::Parser::Execute(char const*, unsigned long)
      2    0.0%    0.0%  t node::(anonymous namespace)::Parser::CreateHeaders()
      2    0.0%    0.0%  t _unwind_stack_from_table_index
      2    0.0%    0.0%  t _allocate_pages
      2    0.0%    0.0%  t __ZN2v88internal12_GLOBAL__N_124ProbeInstantiationsCacheEPNS0_7IsolateEiNS1_11CachingModeE
      2    0.0%    0.0%  T node::binding::GetInternalBinding(v8::FunctionCallbackInfo<v8::Value> const&)
      2    0.0%    0.0%  T node::AsyncWrap::EmitAfter(node::Environment*, double)
      2    0.0%    0.0%  T _mach_vm_purgable_control
      2    0.0%    0.0%  T _guarded_open_np
      2    0.0%    0.0%  T __ZNK2v86String12WriteOneByteEPNS_7IsolateEPhiii
      2    0.0%    0.0%  T __ZNK2v85Value6IsTrueEv
      2    0.0%    0.0%  T __ZN2v88internal10ApiNatives17InstantiateObjectEPNS0_7IsolateENS0_6HandleINS0_18ObjectTemplateInfoEEENS4_INS0_10JSReceiverEEE
      2    0.0%    0.0%  T __ZN2v87Integer15NewFromUnsignedEPNS_7IsolateEj
      1    0.0%    0.0%  t void std::__1::__init_pat<char>(std::__1::money_base::pattern&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, bool, char, char, char, char)
      1    0.0%    0.0%  t non-virtual thunk to node::(anonymous namespace)::Parser::OnStreamAlloc(unsigned long)
      1    0.0%    0.0%  t node::TaskQueue<node::DelayedTask>::Push(std::__1::unique_ptr<node::DelayedTask, std::__1::default_delete<node::DelayedTask> >)
      1    0.0%    0.0%  t node::NodeArrayBufferAllocator::AllocateUninitialized(unsigned long)
      1    0.0%    0.0%  t node::MaybeStackBuffer<uv_buf_t, 16ul>::AllocateSufficientStorage(unsigned long)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(char const*, unsigned long), &(node::(anonymous namespace)::Parser::on_header_value(char const*, unsigned long))>::Raw(llhttp__internal_s*, char const*, unsigned long)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(char const*, unsigned long), &(node::(anonymous namespace)::Parser::on_header_field(char const*, unsigned long))>::Raw(llhttp__internal_s*, char const*, unsigned long)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::Proxy<int (node::(anonymous namespace)::Parser::*)(), &(node::(anonymous namespace)::Parser::on_message_begin())>::Raw(llhttp__internal_s*)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::OnStreamAlloc(unsigned long)
      1    0.0%    0.0%  t node::(anonymous namespace)::Parser::MaybePause()
      1    0.0%    0.0%  t _free_small
      1    0.0%    0.0%  t __read_images
      1    0.0%    0.0%  t __os_nospin_lock_lock_slow
      1    0.0%    0.0%  t ___CFNumberGetTypeID_block_invoke
      1    0.0%    0.0%  t __ZN2v88internal22HandleScopeImplementer12EnterContextENS0_7ContextE
      1    0.0%    0.0%  T std::__1::basic_istream<wchar_t, std::__1::char_traits<wchar_t> >::get(wchar_t&)
      1    0.0%    0.0%  T non-virtual thunk to node::LibuvStreamWrap::GetAsyncWrap()
      1    0.0%    0.0%  T non-virtual thunk to node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
      1    0.0%    0.0%  T node::contextify::ContextifyContext::CompileFunction(v8::FunctionCallbackInfo<v8::Value> const&)
      1    0.0%    0.0%  T node::NodePlatform::CallOnWorkerThread(std::__1::unique_ptr<v8::Task, std::__1::default_delete<v8::Task> >)
      1    0.0%    0.0%  T node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*)
      1    0.0%    0.0%  T node::DTRACE_HTTP_SERVER_RESPONSE(v8::FunctionCallbackInfo<v8::Value> const&)
      1    0.0%    0.0%  T _fprintf
      1    0.0%    0.0%  T __simple_vsprintf
      1    0.0%    0.0%  T __ZNK2v88internal12RootIndexMap6LookupEmPNS0_9RootIndexE
      1    0.0%    0.0%  T __ZNK2v88Function29NewInstanceWithSideEffectTypeENS_5LocalINS_7ContextEEEiPNS1_INS_5ValueEEENS_14SideEffectTypeE
      1    0.0%    0.0%  T __ZNK2v85Value8IsObjectEv
      1    0.0%    0.0%  T __ZNK2v85Value7IsArrayEv
      1    0.0%    0.0%  T __ZNK2v85Value12IntegerValueENS_5LocalINS_7ContextEEE
      1    0.0%    0.0%  T __ZNK2v85Array6LengthEv
      1    0.0%    0.0%  T __ZN2v88internal9Accessors23FunctionPrototypeGetterENS_5LocalINS_4NameEEERKNS_20PropertyCallbackInfoINS_5ValueEEE
      1    0.0%    0.0%  T __ZN2v88internal21PerIsolateAssertScopeILNS0_20PerIsolateAssertTypeE1ELb0EE9IsAllowedEPNS0_7IsolateE
      1    0.0%    0.0%  T __ZN2v88internal21PerIsolateAssertScopeILNS0_20PerIsolateAssertTypeE0ELb1EE9IsAllowedEPNS0_7IsolateE
      1    0.0%    0.0%  T __ZN2v88internal13VirtualMemory14SetPermissionsEmmNS_13PageAllocator10PermissionE
      1    0.0%    0.0%  T __ZN2v88internal12ArrayLiteral17InitDepthAndFlagsEv
      1    0.0%    0.0%  T __ZN2v87Isolate9InContextEv
      1    0.0%    0.0%  T __ZN2v87Isolate10GetCurrentEv
      1    0.0%    0.0%  T __ZN2v87Context5EnterEv
      1    0.0%    0.0%  T __ZN2v87Context4ExitEv
      1    0.0%    0.0%  T __ZN2v87Context29GetNumberOfEmbedderDataFieldsEv
      1    0.0%    0.0%  T __CFExecutableLinkedOnOrAfter

 [Summary]:
   ticks  total  nonlib   name
    728   16.3%   16.5%  JavaScript
   2386   53.6%   53.9%  C++
     88    2.0%    2.0%  GC
     30    0.7%          Shared libraries
   1311   29.4%          Unaccounted

 [C++ entry points]:
   ticks    cpp   total   name
   1477   80.6%   33.2%  T __ZN2v88internal10ClassScope28ResolvePrivateNamesPartiallyEv
     32    1.7%    0.7%  T node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&)
     30    1.6%    0.7%  t _szone_malloc_should_clear
     25    1.4%    0.6%  T __ZN2v86Object3GetENS_5LocalINS_7ContextEEEj
     24    1.3%    0.5%  T __ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii
     14    0.8%    0.3%  T ___mach_stack_logging_enumerate_records
     13    0.7%    0.3%  T void node::StreamBase::JSMethod<&(node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&)
     13    0.7%    0.3%  T _vm_region_recurse_64
     12    0.7%    0.3%  t node::StreamBase::Write(uv_buf_t*, unsigned long, uv_stream_s*, v8::Local<v8::Object>)
     12    0.7%    0.3%  T node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
     10    0.5%    0.2%  T __ZN2v87Isolate17GetCurrentContextEv
      9    0.5%    0.2%  t node::NodeArrayBufferAllocator::Free(void*, unsigned long)
      8    0.4%    0.2%  T node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*)
      8    0.4%    0.2%  T node::ParseEncoding(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
      8    0.4%    0.2%  T node::Environment::GetNow()
      7    0.4%    0.2%  t __ZN2v812_GLOBAL__N_114CallDepthScopeILb0EEC1EPNS_8internal7IsolateENS_5LocalINS_7ContextEEE
      7    0.4%    0.2%  T node::StringBytes::StorageSize(v8::Isolate*, v8::Local<v8::Value>, node::encoding)
      7    0.4%    0.2%  T __ZNK2v85Value8ToStringENS_5LocalINS_7ContextEEE
      7    0.4%    0.2%  T __ZN2v811HandleScope10InitializeEPNS_7IsolateE
      6    0.3%    0.1%  T __ZNK2v86String10Utf8LengthEPNS_7IsolateE
      5    0.3%    0.1%  t _update_cache_for_file_streams
      5    0.3%    0.1%  t __enlarge
      5    0.3%    0.1%  T non-virtual thunk to node::LibuvStreamWrap::IsAlive()
      5    0.3%    0.1%  T node::ParseEncoding(char const*, node::encoding)
      5    0.3%    0.1%  T node::DTRACE_HTTP_SERVER_REQUEST(v8::FunctionCallbackInfo<v8::Value> const&)
      5    0.3%    0.1%  T node::Buffer::HasInstance(v8::Local<v8::Value>)
      5    0.3%    0.1%  T _free
      5    0.3%    0.1%  T __ZNK2v86String6LengthEv
      5    0.3%    0.1%  T __ZNK2v85Value17IsArrayBufferViewEv
      4    0.2%    0.1%  T node::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
      3    0.2%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::SetLengthAndZeroTerminate(unsigned long)
      3    0.2%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::SetLength(unsigned long)
      3    0.2%    0.1%  t node::MaybeStackBuffer<char, 1024ul>::AllocateSufficientStorage(unsigned long)
      3    0.2%    0.1%  t node::(anonymous namespace)::GetLibuvNow(v8::FunctionCallbackInfo<v8::Value> const&)
      3    0.2%    0.1%  t _small_free_list_remove_ptr_no_clear
      3    0.2%    0.1%  t _allocate_pages_securely
      3    0.2%    0.1%  t __ZN2v88internal6String7FlattenEPNS0_7IsolateENS0_6HandleIS1_EENS0_14AllocationTypeE
      3    0.2%    0.1%  T __ZN2v811HandleScopeD1Ev
      2    0.1%    0.0%  t node::Buffer::(anonymous namespace)::ByteLengthUtf8(v8::FunctionCallbackInfo<v8::Value> const&)
      2    0.1%    0.0%  t _unwind_stack_from_table_index
      2    0.1%    0.0%  t __malloc_initialize
      2    0.1%    0.0%  T _malloc
      2    0.1%    0.0%  T __simple_dprintf
      2    0.1%    0.0%  T ___malloc_init
      2    0.1%    0.0%  T ___mach_stack_logging_uniquing_table_read_stack
      2    0.1%    0.0%  T __ZNK2v86String12WriteOneByteEPNS_7IsolateEPhiii
      2    0.1%    0.0%  T __ZNK2v85Value6IsTrueEv
      2    0.1%    0.0%  T __ZN2v811HandleScopeC1EPNS_7IsolateE
      1    0.1%    0.0%  t node::NodeArrayBufferAllocator::AllocateUninitialized(unsigned long)
      1    0.1%    0.0%  t node::MaybeStackBuffer<uv_buf_t, 16ul>::AllocateSufficientStorage(unsigned long)
      1    0.1%    0.0%  t _free_small
      1    0.1%    0.0%  T non-virtual thunk to node::LibuvStreamWrap::GetAsyncWrap()
      1    0.1%    0.0%  T non-virtual thunk to node::LibuvStreamWrap::DoTryWrite(uv_buf_t**, unsigned long*)
      1    0.1%    0.0%  T node::DTRACE_HTTP_SERVER_RESPONSE(v8::FunctionCallbackInfo<v8::Value> const&)
      1    0.1%    0.0%  T __simple_vsprintf
      1    0.1%    0.0%  T __ZNK2v85Value8IsObjectEv
      1    0.1%    0.0%  T __ZNK2v85Value7IsArrayEv
      1    0.1%    0.0%  T __ZNK2v85Array6LengthEv

 [Bottom up (heavy) profile]:
  Note: percentage shows a share of a particular caller in the total
  amount of its parent calls.
  Callers occupying less than 1.0% are not shown.

   ticks parent  name
   1612   36.2%  T __ZN2v88internal10ClassScope28ResolvePrivateNamesPartiallyEv
    273   16.9%    T __ZN2v88internal10ClassScope28ResolvePrivateNamesPartiallyEv
     80   29.3%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     78   97.5%        LazyCompile: *parserOnIncoming _http_server.js:662:26
     78  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      2    2.5%        LazyCompile: *emit events.js:153:44
      2  100.0%          LazyCompile: ~parserOnIncoming _http_server.js:662:26
      2  100.0%            LazyCompile: ~parserOnHeadersComplete _http_common.js:71:33
     48   17.6%      LazyCompile: *_storeHeader _http_outgoing.js:285:22
     46   95.8%        LazyCompile: *write_ _http_outgoing.js:564:16
     46  100.0%          LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     46  100.0%            LazyCompile: *parserOnIncoming _http_server.js:662:26
      1    2.1%        LazyCompile: ~writeHead _http_server.js:234:19
      1  100.0%          LazyCompile: ~_implicitHeader _http_server.js:229:68
      1  100.0%            LazyCompile: ~write_ _http_outgoing.js:564:16
      1    2.1%        LazyCompile: *writeHead _http_server.js:234:19
      1  100.0%          LazyCompile: ~_implicitHeader _http_server.js:229:68
      1  100.0%            LazyCompile: ~write_ _http_outgoing.js:564:16
     43   15.8%      LazyCompile: *Readable.read _stream_readable.js:400:35
     39   90.7%        LazyCompile: *resume_ _stream_readable.js:920:17
     39  100.0%          LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      4    9.3%        LazyCompile: *emitReadable_ _stream_readable.js:560:23
      4  100.0%          LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
     39   14.3%      LazyCompile: *clearBuffer _stream_writable.js:498:21
     38   97.4%        LazyCompile: *assignSocket _http_server.js:203:62
     37   97.4%          LazyCompile: *resOnFinish _http_server.js:617:21
     34   91.9%            LazyCompile: *onFinish _http_outgoing.js:657:18
      3    8.1%            LazyCompile: *emit events.js:153:44
      1    2.6%          LazyCompile: ~resOnFinish _http_server.js:617:21
      1  100.0%            LazyCompile: *emit events.js:153:44
      1    2.6%        LazyCompile: ~Writable.uncork _stream_writable.js:311:37
      1  100.0%          LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      1  100.0%            LazyCompile: *parserOnIncoming _http_server.js:662:26
      5    1.8%      LazyCompile: ~_storeHeader _http_outgoing.js:285:22
      3   60.0%        LazyCompile: *write_ _http_outgoing.js:564:16
      3  100.0%          LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      3  100.0%            LazyCompile: *parserOnIncoming _http_server.js:662:26
      2   40.0%        LazyCompile: ~writeHead _http_server.js:234:19
      2  100.0%          LazyCompile: ~_implicitHeader _http_server.js:229:68
      2  100.0%            LazyCompile: ~write_ _http_outgoing.js:564:16
      4    1.5%      LazyCompile: *Writable.uncork _stream_writable.js:311:37
      4  100.0%        LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      4  100.0%          LazyCompile: *parserOnIncoming _http_server.js:662:26
      4  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      3    1.1%      LazyCompile: *parserOnIncoming _http_server.js:662:26
      3  100.0%        LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      3    1.1%      LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
    226   14.0%    LazyCompile: *clearBuffer _stream_writable.js:498:21
    226  100.0%      LazyCompile: *assignSocket _http_server.js:203:62
    224   99.1%        LazyCompile: *resOnFinish _http_server.js:617:21
    216   96.4%          LazyCompile: *onFinish _http_outgoing.js:657:18
    216  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      8    3.6%          LazyCompile: *emit events.js:153:44
      8  100.0%            LazyCompile: ~onFinish _http_outgoing.js:657:18
    117    7.3%    LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     61    3.8%    LazyCompile: *assignSocket _http_server.js:203:62
     61  100.0%      LazyCompile: *resOnFinish _http_server.js:617:21
     61  100.0%        LazyCompile: *onFinish _http_outgoing.js:657:18
     61  100.0%          LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     61  100.0%            LazyCompile: *afterWrite _stream_writable.js:479:20
     52    3.2%    LazyCompile: *resOnFinish _http_server.js:617:21
     50   96.2%      LazyCompile: *onFinish _http_outgoing.js:657:18
     50  100.0%        LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     50  100.0%          LazyCompile: *afterWrite _stream_writable.js:479:20
     50  100.0%            LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      2    3.8%      LazyCompile: *emit events.js:153:44
      2  100.0%        LazyCompile: ~onFinish _http_outgoing.js:657:18
      2  100.0%          LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      1   50.0%            LazyCompile: ~afterWrite _stream_writable.js:479:20
      1   50.0%            LazyCompile: *afterWrite _stream_writable.js:479:20
     47    2.9%    LazyCompile: *parserOnIncoming _http_server.js:662:26
     47  100.0%      LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     38    2.4%    LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     38  100.0%      LazyCompile: *parserOnIncoming _http_server.js:662:26
     38  100.0%        LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     36    2.2%    LazyCompile: *write_ _http_outgoing.js:564:16
     36  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     36  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
     36  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     35    2.2%    LazyCompile: *onwrite _stream_writable.js:445:17
     32   91.4%      LazyCompile: *clearBuffer _stream_writable.js:498:21
     32  100.0%        LazyCompile: *assignSocket _http_server.js:203:62
     32  100.0%          LazyCompile: *resOnFinish _http_server.js:617:21
     28   87.5%            LazyCompile: *onFinish _http_outgoing.js:657:18
      4   12.5%            LazyCompile: *emit events.js:153:44
      3    8.6%      LazyCompile: *afterWriteDispatched internal/stream_base_commons.js:141:30
      3  100.0%        LazyCompile: *Writable.uncork _stream_writable.js:311:37
      3  100.0%          LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      3  100.0%            LazyCompile: *parserOnIncoming _http_server.js:662:26
     33    2.0%    LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
     28    1.7%    LazyCompile: *_storeHeader _http_outgoing.js:285:22
     28  100.0%      LazyCompile: *write_ _http_outgoing.js:564:16
     28  100.0%        LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     28  100.0%          LazyCompile: *parserOnIncoming _http_server.js:662:26
     28  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     27    1.7%    LazyCompile: *setHeader _http_outgoing.js:462:57
     27  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     27  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
     27  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     27    1.7%    LazyCompile: *Writable.uncork _stream_writable.js:311:37
     27  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     27  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
     27  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     17    1.1%    LazyCompile: *resume_ _stream_readable.js:920:17
     17  100.0%      LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35

   1311   29.4%  UNKNOWN
   1094   83.4%    LazyCompile: *clearBuffer _stream_writable.js:498:21
   1091   99.7%      LazyCompile: *assignSocket _http_server.js:203:62
   1089   99.8%        LazyCompile: *resOnFinish _http_server.js:617:21
   1060   97.3%          LazyCompile: *onFinish _http_outgoing.js:657:18
   1060  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     29    2.7%          LazyCompile: *emit events.js:153:44
     29  100.0%            LazyCompile: ~onFinish _http_outgoing.js:657:18
    124    9.5%    LazyCompile: *Writable.uncork _stream_writable.js:311:37
    124  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
    124  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
    124  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33

     61    1.4%  LazyCompile: *onwrite _stream_writable.js:445:17
     56   91.8%    LazyCompile: *clearBuffer _stream_writable.js:498:21
     56  100.0%      LazyCompile: *assignSocket _http_server.js:203:62
     56  100.0%        LazyCompile: *resOnFinish _http_server.js:617:21
     55   98.2%          LazyCompile: *onFinish _http_outgoing.js:657:18
     55  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      1    1.8%          LazyCompile: *emit events.js:153:44
      1  100.0%            LazyCompile: ~onFinish _http_outgoing.js:657:18
      3    4.9%    LazyCompile: *assignSocket _http_server.js:203:62
      3  100.0%      LazyCompile: *resOnFinish _http_server.js:617:21
      3  100.0%        LazyCompile: *onFinish _http_outgoing.js:657:18
      3  100.0%          LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      3  100.0%            LazyCompile: *afterWrite _stream_writable.js:479:20
      2    3.3%    LazyCompile: *afterWriteDispatched internal/stream_base_commons.js:141:30
      2  100.0%      LazyCompile: *Writable.uncork _stream_writable.js:311:37
      2  100.0%        LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      2  100.0%          LazyCompile: *parserOnIncoming _http_server.js:662:26
      2  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33

     49    1.1%  LazyCompile: *resOnFinish _http_server.js:617:21
     44   89.8%    LazyCompile: *onFinish _http_outgoing.js:657:18
     44  100.0%      LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     44  100.0%        LazyCompile: *afterWrite _stream_writable.js:479:20
     44  100.0%          LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35
      5   10.2%    LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      5  100.0%      LazyCompile: *afterWrite _stream_writable.js:479:20
      5  100.0%        LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35

     49    1.1%  LazyCompile: *clearBuffer _stream_writable.js:498:21
     47   95.9%    LazyCompile: *assignSocket _http_server.js:203:62
     47  100.0%      LazyCompile: *resOnFinish _http_server.js:617:21
     44   93.6%        LazyCompile: *onFinish _http_outgoing.js:657:18
     44  100.0%          LazyCompile: *onCorkedFinish _stream_writable.js:672:24
     44  100.0%            LazyCompile: *afterWrite _stream_writable.js:479:20
      3    6.4%        LazyCompile: *emit events.js:153:44
      3  100.0%          LazyCompile: ~onFinish _http_outgoing.js:657:18
      3  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      2    4.1%    LazyCompile: *resOnFinish _http_server.js:617:21
      2  100.0%      LazyCompile: *onFinish _http_outgoing.js:657:18
      2  100.0%        LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      2  100.0%          LazyCompile: *afterWrite _stream_writable.js:479:20
      2  100.0%            LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35

     46    1.0%  t _szone_malloc_should_clear
     25   54.3%    LazyCompile: *clearBuffer _stream_writable.js:498:21
     24   96.0%      LazyCompile: *assignSocket _http_server.js:203:62
     24  100.0%        LazyCompile: *resOnFinish _http_server.js:617:21
     24  100.0%          LazyCompile: *onFinish _http_outgoing.js:657:18
     24  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      1    4.0%      LazyCompile: ~Writable.uncork _stream_writable.js:311:37
      1  100.0%        LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      1  100.0%          LazyCompile: *parserOnIncoming _http_server.js:662:26
      1  100.0%            LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
     11   23.9%    T __ZN2v88internal10ClassScope28ResolvePrivateNamesPartiallyEv
     10   90.9%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
     10  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
     10  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33
      1    9.1%      LazyCompile: ~resOnFinish _http_server.js:617:21
      1  100.0%        LazyCompile: *emit events.js:153:44
      1  100.0%          LazyCompile: ~onFinish _http_outgoing.js:657:18
      1  100.0%            LazyCompile: *onCorkedFinish _stream_writable.js:672:24
      5   10.9%    LazyCompile: *Writable.uncork _stream_writable.js:311:37
      5  100.0%      LazyCompile: *<anonymous> /Users/bfarias/Documents/node/bench.js:3:54
      5  100.0%        LazyCompile: *parserOnIncoming _http_server.js:662:26
      5  100.0%          LazyCompile: *parserOnHeadersComplete _http_common.js:71:33

     46    1.0%  LazyCompile: *processTicksAndRejections internal/process/task_queues.js:65:35

@guybedford
Copy link
Contributor Author

It sounds like the context is deoptimizing more than we can allow, so we probably need to reconsider the technical approach here.

Closing to reopen a new PR if we make progress on that.

@guybedford guybedford closed this Jul 31, 2019
@guybedford guybedford deleted the module-globals branch July 31, 2019 20:47
@guybedford guybedford restored the module-globals branch July 31, 2019 20:47
@guybedford guybedford deleted the module-globals branch July 31, 2019 20:47
@guybedford guybedford restored the module-globals branch July 31, 2019 20:47
@guybedford
Copy link
Contributor Author

To update here further, after exploring various alternatives in discussions with @bmeck and @devsnek it seems to be the case that there is simply nothing we can do without some serious assistance from v8 on this, which we were unable to get any interest in.

Perhaps a later TC39 proposal can provide per-module global access permissions, and we can focus our future efforts there, but for now I'll be abandoning this deprecation. Thanks all for your help and feedback.

@erights
Copy link
Contributor

erights commented Aug 2, 2019

Perhaps a later TC39 proposal can provide per-module global access permissions

Yes. Realms and SES

@guybedford
Copy link
Contributor Author

Yes. Realms and SES

The problem we have is that the npm ecosystem will now proliferate with ES modules containing global process access, which is a big security loss for the Node.js ecosystem. But yes hopefully we can find future mitigations or deprecation paths. A TC39 proposal to explicitly provide a deprecation path for specific globals would allow shaping the ecosystem in this way, and may even be useful for browsers as well for similar goals.

@guybedford
Copy link
Contributor Author

The issue being that, a custom realm that doesn't provide the global process, will simply not support large swathes of the ecosystem due to compatibility issues on the expectation of global process being present.

@erights
Copy link
Contributor

erights commented Aug 2, 2019

SES enables virtualizing globals as well, so that an individual module can be given a global binding of process to an emulated process object that provides just the authority that module should have.

@guybedford
Copy link
Contributor Author

@erights global-per-module virtualization (or even global-per-package boundary) seems very expensive for performance, especially with module counts of the scale of the npm ecosystem. Seems like it makes it much harder to justify. I agree we likely need a separate secure JS runtime from Node.js at this point, especially given the outcome of this PR. Perhaps the process authority problem might be handled through code mods / security code analysis approaches.

@erights
Copy link
Contributor

erights commented Aug 2, 2019

It should only be a few objects per compartment. If compartments are expensive enough to deter using them for safe module linkage, they weren't implemented right.

Perhaps the process authority problem might be handled through code mods / security code analysis approaches.

In a SES environment code can only dereference the process global of its compartment's global if

  • It uses the name process as a free variable name, or
  • if it obtains its global object, such as by globalThis, or
  • It evaluates code which does any of these, using one of this compartment's evaluators (eval, Function).

The first can reliably be statically recognized. The other two are interesting.

I'm betting that separate compartments will prove to be the more practical way to give different modules access to different global bindings of process, as well as the absence of such a binding.

@guybedford
Copy link
Contributor Author

It should only be a few objects per compartment. If compartments are expensive enough to deter using them for safe module linkage, they weren't implemented right.

All top-level lookups being deoptimized (as in they can't be inlined on hotpaths) due to the top-level context wrapper managing this is exactly the performance reason this PR can't move forward. I'd expect SES suffers from the same issue.

If the builtins are shared between the compartment wrappers then it can be done performantly apart from that, but until v8 optimize the top-level context that seems like the major common issue.

The first can reliably be statically recognized. The other two are interesting.

The binding escape analysis needed both in build tool optimizations and security analysis are very similar problems, and interesting ones indeed.

@erights
Copy link
Contributor

erights commented Aug 3, 2019

All top-level lookups being deoptimized (as in they can't be inlined on hotpaths) due to the top-level context wrapper managing this is exactly the performance reason this PR can't move forward. I'd expect SES suffers from the same issue.

The SES shim will definitely suffer from this issue. However, SES is a proposal. Once accepted, the platform will directly support Compartments. There's no reason for platform supported compartments to have any extra overheads.

If the builtins are shared between the compartment wrappers then it can be done performantly apart from that, but until v8 optimize the top-level context that seems like the major common issue.

I don't understand this sentence. Clarify? Thanks.

The binding escape analysis needed both in build tool optimizations and security analysis are very similar problems, and interesting ones indeed.

Fortunately, SES and the SES shim do not rely on any additional static analysis, and so work soundly despite the notorious difficulty of statically analyzing JavaScript.

Our transitions plans do rely on @bmeck 's TOFU analysis, but this need only be approximate. Neither TOFU failures of inclusion or exclusion make the security enforcement unsound. Though of course, TOFU imprecisions impede the process of getting the code working again in a much more secure manner.

@dtribble
Copy link

dtribble commented Aug 3, 2019

Actually, if process is added to the "optimizer" for the SES shim in the a compartment to which it is authorized, then it should be fast and not disrupt any fast execution path for that variable. The ability to have key global "endowments" added to the optimizer is crucial and on the roadmap.

@erights
Copy link
Contributor

erights commented Aug 3, 2019

Note that the optimizer mechanism is only appropriate when the property is a non-configurable, non-writable data property, since this guarantees that its value won't change. The Realm shim optimizer mechanism will notice this and shadow it with a const declaration of the same name and value. This is actually faster than a regular global.

@guybedford
Copy link
Contributor Author

The problem with the optimization approach is:

  1. Code that does const process = global.process or similar throws for redefinition of the binding. This can be worked around by catching the redefinition error at compilation and falling back to the slow path, but then....
  2. Exactly as @erights mentions we still need to support APM use cases such as global.process = instrument(process) assignment, process = customProcess assignment affecting all global.process accesses.

These hard backwards compatibility constraints mean the optimizations approaches can't work in Node.js. The issues will likely also be hit for a secure Node.js environment that wants to support third-party packages, but perhaps they are a bit more relaxed for a security-focused project on top of Node - SES likely doesn't need to support (2) apart from possibly through an attenuation phase that could be locked down.

The slow paths in this PR are also not for the hits though - the slow paths are for the fall-throughs. Because we have an inner context, falling back to the outer global. The test case brought up was with the use of JSON.parse where the JSON lookup was deoptimized due to process and Buffer in the context.

Ideally, the optimization we would need from v8 here would be that Object.seal(context) would know that anything not in the list of properties of the context can be optimized, instead of blanket deoptimizing everything. In theory that is trivial to do and fully compatible, which is so frustrating, because it's really just an engine optimization that is holding us back due to a sheer lack of being able to approach that engine work.

I guess this fallthrough case doesn't apply to SES though actually since it only has the single wrapping of the context, instead of say a two-layer context. Although I'm still not sure I follow how process could be conditionally provided to packages without every package having an entirely distinct global, which seems like it might lead to some global instancing issues or bugs / large object allocations having global-per-module?

Would be great to discuss further, maybe we can add this as an agenda item to the coming SES meeting if there'd be time for it, or another place we can discuss to avoid continuing to pollute this thread.

Lioness100 added a commit to Lioness100/sapphire-template that referenced this pull request Dec 27, 2021
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.