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

feat: support performance timer for more precise milliseconds #74

Merged
merged 5 commits into from
Dec 5, 2021

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Nov 20, 2021

e.g.: 1.375ms better than 1ms

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@codecov
Copy link

codecov bot commented Nov 20, 2021

Codecov Report

Merging #74 (5a6c012) into master (c08ec23) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #74      +/-   ##
==========================================
+ Coverage   97.36%   97.39%   +0.02%     
==========================================
  Files          14       14              
  Lines         456      461       +5     
  Branches       72       73       +1     
==========================================
+ Hits          444      449       +5     
  Misses         12       12              
Impacted Files Coverage Δ
lib/utils.js 92.00% <ø> (ø)
lib/egg/context_logger.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c08ec23...5a6c012. Read the comment docs.

fengmk2 added a commit to eggjs/egg that referenced this pull request Nov 20, 2021
detail see eggjs/egg-logger#74

How to use:

```js
// config.js

exports.logger = {
  enablePerformanceTimer: true,
};
```
// Starting...
// 10 tests completed.

// logger.error(err) x 378,794 ops/sec ±1.35% (91 runs sampled)
Copy link
Member Author

Choose a reason for hiding this comment

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

只要升级 node 到 16,性能就翻倍。

fengmk2 added a commit to fengmk2/leoric that referenced this pull request Nov 20, 2021
detail see eggjs/egg-logger#74

before:
```log
[query] [1] DROP TABLE IF EXISTS `clients`
```

after:
```log
[query] [1.478] DROP TABLE IF EXISTS `clients`
```
cyjake pushed a commit to cyjake/leoric that referenced this pull request Nov 20, 2021
detail see eggjs/egg-logger#74

before:
```log
[query] [1] DROP TABLE IF EXISTS `clients`
```

after:
```log
[query] [1.478] DROP TABLE IF EXISTS `clients`
```
fengmk2 added a commit to fengmk2/leoric that referenced this pull request Nov 22, 2021
detail see eggjs/egg-logger#74

before:
```log
[query] [1] DROP TABLE IF EXISTS `clients`
```

after:
```log
[query] [1.478] DROP TABLE IF EXISTS `clients`
```
cyjake pushed a commit to cyjake/leoric that referenced this pull request Nov 22, 2021
detail see eggjs/egg-logger#74

before:
```log
[query] [1] DROP TABLE IF EXISTS `clients`
```

after:
```log
[query] [1.478] DROP TABLE IF EXISTS `clients`
```
@fengmk2
Copy link
Member Author

fengmk2 commented Nov 23, 2021

@popomore @atian25 帮忙看看?

@fengmk2 fengmk2 requested a review from popomore December 5, 2021 04:15
const m = body.match(/\/\d*ms/g);
(parseInt(m[1].substring(1)) > parseInt(m[0].substring(1))).should.equal(true);
const m = body.match(/\/\d+ms/g);
console.log(m);
Copy link
Member

Choose a reason for hiding this comment

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

console

.github/workflows/nodejs.yml Show resolved Hide resolved
@fengmk2 fengmk2 merged commit f42cb95 into master Dec 5, 2021
@fengmk2 fengmk2 deleted the support-performance-timer branch December 5, 2021 15:57
@fengmk2
Copy link
Member Author

fengmk2 commented Dec 5, 2021

2.7.0

fengmk2 added a commit to eggjs/egg that referenced this pull request Dec 5, 2021
detail see eggjs/egg-logger#74

How to use:

```js
// config.js

exports.logger = {
  enablePerformanceTimer: true,
};
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants