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

stdlib: cache environment variables #454

Merged
merged 1 commit into from
Oct 29, 2020
Merged

stdlib: cache environment variables #454

merged 1 commit into from
Oct 29, 2020

Conversation

dirkdev98
Copy link
Member

Removes the 'log' export from 'insight'.

Accessing process.env.XXX is relatively slow in Node.js.
Benchmark of a plain object property access and accessing process.env.NODE_ENV:

property access       500000000  iterations     0  ns/op
process.env access      5000000  iterations   246  ns/op

See this thread nodejs/node#3104 for some more context

Removes the 'log' export from 'insight'.

Accessing process.env.XXX is relatively slow in Node.js.
Benchmark of a plain object property access and accessing process.env.NODE_ENV:

```
property access       500000000  iterations     0  ns/op
process.env access      5000000  iterations   246  ns/op
```

See this thread nodejs/node#3104 for some more context
@github-actions
Copy link
Contributor

==== Benchmark result ====

Node.js version: 14

Total benchmarks: 9
          Passed: 9
          Failed: 0
-----------
object validator simple      5000000  iterations     444  ns/op
object validator nested        50000  iterations   41295  ns/op
logger - strings              500000  iterations    2053  ns/op
logger - objects              500000  iterations    2565  ns/op
logger - deep objects         500000  iterations    4447  ns/op
uuid                         2000000  iterations     518  ns/op
uuid.isValid                10000000  iterations     124  ns/op
isNil                      500000000  iterations       0  ns/op
isPlainObject              100000000  iterations      16  ns/op

@github-actions
Copy link
Contributor

==== C8 test coverage ====
Statements: 71.78% ( 17662/24607 )
Branches : 71.32% ( 2091 /2932 )
Functions : 72.44% ( 665 /918 )
Lines : 71.78% ( 17662 /24607 )

@github-actions
Copy link
Contributor

==== Benchmark result ====

Node.js version: 15

Total benchmarks: 9
          Passed: 9
          Failed: 0
-----------
object validator simple      5000000  iterations     480  ns/op
object validator nested        50000  iterations   47916  ns/op
logger - strings              500000  iterations    2167  ns/op
logger - objects              500000  iterations    2816  ns/op
logger - deep objects         500000  iterations    4668  ns/op
uuid                         2000000  iterations     631  ns/op
uuid.isValid                10000000  iterations     143  ns/op
isNil                      500000000  iterations       0  ns/op
isPlainObject              100000000  iterations      17  ns/op

@dirkdev98 dirkdev98 merged commit 4576811 into main Oct 29, 2020
@dirkdev98 dirkdev98 deleted the feat/env-cache branch October 29, 2020 22:19
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.

1 participant