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

ci: bring up benchmark #3776

Merged
merged 7 commits into from Oct 22, 2019
Merged

ci: bring up benchmark #3776

merged 7 commits into from Oct 22, 2019

Conversation

@SukkaW
Copy link
Member

SukkaW commented Oct 17, 2019

What does it do?

Add a benchmark.sh under test directory, used to perform benchmark for every build on travis ci, which enables us to evaluate the generation speed after each commit.

How to test

git clone -b benchmark https://github.com/sukkaw/hexo.git
cd hexo
npm install
./test/benchmark.sh

Screenshots

image

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.
@SukkaW SukkaW requested review from segayuu and curbengh Oct 17, 2019
@coveralls

This comment has been minimized.

Copy link

coveralls commented Oct 17, 2019

Coverage Status

Coverage remained the same at 97.267% when pulling 27b89c1 on SukkaW:benchmark into 52adf39 on hexojs:master.

- output log
- add another cold process
@SukkaW SukkaW requested a review from hexojs/core Oct 18, 2019
time_render_finish=$(date +%s.%3N -d "$(awk '/.*INFO.*generated in /{print $1}' build.log)")
time_database_saved=$(date +%s.%3N -d "$(awk '/.*DEBUG Database saved/{print $1}' build.log)")

echo "Load Plugin/Scripts/Database $(_SUBSTRUCTION $time_process_start $time_begin)\nProcess Source $(_SUBSTRUCTION $time_render_start $time_process_start)\nRender Files $(_SUBSTRUCTION $time_render_finish $time_render_start)\nSave Database $(_SUBSTRUCTION $time_database_saved $time_render_finish)" | awk '{printf "| %-28s | %7.3fs |\n",$1" "$2,$3"s"}'

This comment has been minimized.

Copy link
@YoshinoriN

YoshinoriN Oct 19, 2019

Member

IMHO this line too long. How about divide this into function like the following?

_MESSAGE_FORMATTER () {
    awk '{printf "| %-28s | %7.3fs |\n",$1" "$2,$3"s"}'
}

LOG_TABLE () {
    time_begin=$(date +%s -d "$(awk '/.*DEBUG Hexo version/{print $1}' build.log)")

    ...

    load_message="Load Plugin/Scripts/Database $(_SUBSTRUCTION $time_process_start $time_begin)"
    process_source_message="Process Source $(_SUBSTRUCTION $time_render_start $time_process_start)"
    render_files_message="Render Files $(_SUBSTRUCTION $time_render_finish $time_render_start)"
    save_database_message="Save Database $(_SUBSTRUCTION $time_database_saved $time_render_finish)"

    echo $load_message | _MESSAGE_FORMATTER
    echo $process_source_message | _MESSAGE_FORMATTER
    echo $render_files_message | _MESSAGE_FORMATTER
    echo $save_database_message | _MESSAGE_FORMATTER
}

This comment has been minimized.

Copy link
@SukkaW

SukkaW Oct 19, 2019

Author Member

Updated.

Copy link
Member

YoshinoriN left a comment

How about add Total time?

"Total time $(_SUBSTRUCTION $time_database_saved $time_begin)"
@SukkaW

This comment has been minimized.

Copy link
Member Author

SukkaW commented Oct 19, 2019

How about add Total time?

"Total time $(_SUBSTRUCTION $time_database_saved $time_begin)"

Added.

@SukkaW SukkaW requested a review from YoshinoriN Oct 19, 2019
Copy link
Member

YoshinoriN left a comment

LGTM :)

Copy link
Contributor

curbengh left a comment

LGTM. It would be nice to see memory consumption too.

@SukkaW

This comment has been minimized.

Copy link
Member Author

SukkaW commented Oct 20, 2019

@curbengh I'd like to add time in the benchmark.sh, but it is a little tricky to redirect time output to a file. I will have a try.

@SukkaW SukkaW dismissed stale reviews from curbengh and YoshinoriN via d4f217a Oct 20, 2019
SukkaW added 2 commits Oct 20, 2019
@SukkaW SukkaW force-pushed the SukkaW:benchmark branch from 176a084 to 27b89c1 Oct 20, 2019
@SukkaW SukkaW requested review from curbengh and YoshinoriN Oct 20, 2019
@SukkaW

This comment has been minimized.

Copy link
Member Author

SukkaW commented Oct 20, 2019

The memory usage is now added

.travis.yml Show resolved Hide resolved
@SukkaW SukkaW merged commit 3448a6d into hexojs:master Oct 22, 2019
4 checks passed
4 checks passed
Travis CI - Pull Request Build Passed
Details
codeclimate All good!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls Coverage remained the same at 97.267%
Details
oncletom added a commit to oncletom/hexo that referenced this pull request Jan 17, 2020
* ci: bring up benchmark
* ci: update benchmark

- output log
- add another cold process

* ci: simplify benchmark code & add total time
* ci: add memory usage to benchmark
* ci: fix benchmark output format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.