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 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 October 17, 2019 17:36
@coveralls
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 a team October 18, 2019 14:47
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"}'
Copy link
Member

@yoshinorin yoshinorin Oct 19, 2019

Choose a reason for hiding this comment

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

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
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

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

How about add Total time?

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

@SukkaW
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 October 19, 2019 18:25
yoshinorin
yoshinorin previously approved these changes Oct 20, 2019
Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

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

LGTM :)

curbengh
curbengh previously approved these changes Oct 20, 2019
Copy link
Contributor

@curbengh curbengh left a comment

Choose a reason for hiding this comment

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

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

@SukkaW
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 October 20, 2019 11:25
@SukkaW
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
thom4parisot pushed a commit to thom4parisot/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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants