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

Improve boot performance #262

Merged
merged 13 commits into from Jun 15, 2021
Merged

Improve boot performance #262

merged 13 commits into from Jun 15, 2021

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Jun 11, 2021

I'm trying to reduce the boot time of Mali. There are lots of things to do, but most significant thing I've realized is that we need to remove lodash forOwn usage. Even changing it with a for(const el in obj) improves the performance a lot. This pull request creates a benchmark suite for addService and includes all the performance changes to reduce addService duration.

Initial

> mali@0.43.1 benchmark
> node test/benchmark.js

metadata.create x 725 ops/sec ±0.19% (95 runs sampled)
mali.addService x 12,350 ops/sec ±3.70% (89 runs sampled)
mali.use x 12,727 ops/sec ±1.75% (90 runs sampled)

Current

Platform info:
==============
   Darwin 20.5.0 arm64
   Node.JS: 16.2.0
   V8: 9.0.257.25-node.16
   Apple M1 × 8

Suite: Functions
✔ metadata.create                             747 rps
✔ mali.addService                          13,170 rps
✔ mali.use                                 13,259 rps
✔ mali.use as global middleware            13,559 rps

   metadata.create                     -94.49%            (747 rps)   (avg: 1ms)
   mali.addService                      -2.87%         (13,170 rps)   (avg: 75μs)
   mali.use                             -2.21%         (13,259 rps)   (avg: 75μs)
   mali.use as global middleware            0%         (13,559 rps)   (avg: 73μs)
-----------------------------------------------------------------------

@anonrig anonrig requested a review from bojand June 11, 2021 11:47
@anonrig anonrig changed the title Perf/add service Improve addService performance and compare it through benchmarks Jun 11, 2021
@coveralls
Copy link

coveralls commented Jun 11, 2021

Coverage Status

Coverage increased (+0.4%) to 97.76% when pulling 5acf678 on perf/addService into 3cd4000 on master.

@malijs malijs deleted a comment from coveralls Jun 11, 2021
@anonrig anonrig changed the title Improve addService performance and compare it through benchmarks Improve boot performance Jun 14, 2021
@anonrig anonrig merged commit 13f656e into master Jun 15, 2021
@anonrig anonrig deleted the perf/addService branch June 15, 2021 12:48
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.

None yet

2 participants