警告:本文章非专业对比,仅供参考!

本文章会从以下方面对比:

  • 安装速度对比
  • 新建站点速度对比
  • 文章生成速度对比
  • 网页生成速度对比
  • 本地预览速度对比 (省流:hugo 比 hexo 快)
  • 文档完善程度 (这个不会看,以后再说)

# 测试环境

h
user@localhost ~> cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.18.5
PRETTY_NAME="Alpine Linux v3.18"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
user@localhost ~> arch
x86_64

注:为保证公平性,默认安装 nodejs 和 npm

hexo 使用的主题: https://github.com/ahonn/hexo-theme-even

hugo 使用的主题: https://github.com/olOwOlo/hugo-theme-even

# 安装速度对比

  • hexo
    运行脚本:
h
yarn global add hexo-cli

输出结果:

h
user@localhost ~> yarn global add hexo-cli
yarn global v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "hexo-cli@4.3.1" with binaries:
      - hexo
Done in 21.80s.
  • hugo
    运行脚本:
h
#!/bin/bash
set -e
export A=$(date +%s)
sudo apk add hugo
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
(1/2) Installing hugo (0.120.4-r0)
(2/2) Installing hugo-fish-completion (0.120.4-r0)
Executing busybox-1.36.1-r17.trigger
OK: 192 MiB in 69 packages
0min19s

# 新建站点速度对比

  • hexo
    运行脚本:
h
#!/bin/bash
set -e
export A=$(date +%s)
mkdir blog-hexo && cd blog-hexo
hexo init
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
INFO  Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO  Install dependencies
warning hexo > warehouse > cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
warning hexo-renderer-marked > jsdom > abab@2.0.6: Use your platform's native atob() and btoa() methods instead
warning hexo-renderer-marked > jsdom > data-urls > abab@2.0.6: Use your platform's native atob() and btoa() methods instead
INFO  Start blogging with Hexo!
2min6s
  • hugo
    运行脚本:
h
#!/bin/bash
set -e
export A=$(date +%s)
hugo new site blog-hugo
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
Congratulations! Your new Hugo site was created in /home/user/blog-hugo.
Just a few more steps...
1. Change the current directory to /home/user/blog-hugo.
2. Create or install a theme:
   - Create a new theme with the command "hugo new theme <THEMENAME>"
   - Install a theme from https://themes.gohugo.io/
3. Edit hugo.toml, setting the "theme" property to the theme name.
4. Create new content with the command "hugo new content <SECTIONNAME>/<FILENAME>.<FORMAT>".
5. Start the embedded web server with the command "hugo server --buildDrafts".
See documentation at https://gohugo.io/.
0min2s

# 文章生成速度对比

  • hexo
    运行脚本:
h
#!/bin/bash
set -e
export A=$(date +%s)
hexo new test
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
INFO  Validating config
INFO  Created: ~/blog-hexo/source/_posts/test.md
0min21s
  • hugo
    运行脚本:
h
#!/bin/bash
set -e
export A=$(date +%s)
hugo new test.md
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
Content "/home/user/blog-hugo/content/test.md" created
0min2s

# 网页生成速度对比

  • hexo
    运行脚本:
h
#!/bin/bash
set -e
export A=$(date +%s)
hexo g
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
INFO  Validating config
INFO  Start processing
INFO  Files loaded in 2.05 s
INFO  Generated: archives/1970/index.html
INFO  Generated: archives/2023/index.html
INFO  Generated: archives/index.html
INFO  Generated: archives/1970/01/index.html
INFO  Generated: archives/2023/12/index.html
INFO  Generated: css/style.scss
INFO  Generated: favicon.ico
INFO  Generated: robots.txt
INFO  Generated: index.html
INFO  Generated: lib/fancybox/fancybox_overlay.png
INFO  Generated: lib/fancybox/helpers/fancybox_buttons.png
INFO  Generated: fonts/chancery/apple-chancery-webfont.svg
INFO  Generated: lib/fancybox/fancybox_sprite@2x.png
INFO  Generated: lib/fancybox/fancybox_sprite.png
INFO  Generated: lib/fancybox/fancybox_loading.gif
INFO  Generated: lib/jquery/jquery.min.js
INFO  Generated: lib/slideout/slideout.js
INFO  Generated: fonts/chancery/apple-chancery-webfont.ttf
INFO  Generated: lib/fancybox/blank.gif
INFO  Generated: lib/fancybox/jquery.fancybox.js
INFO  Generated: lib/fancybox/jquery.fancybox.pack.js
INFO  Generated: lib/fancybox/jquery.fancybox.css
INFO  Generated: lib/fancybox/helpers/jquery.fancybox-buttons.css
INFO  Generated: lib/fancybox/helpers/jquery.fancybox-thumbs.css
INFO  Generated: lib/fancybox/helpers/jquery.fancybox-buttons.js
INFO  Generated: lib/slideout/slideout.min.js
INFO  Generated: lib/fancybox/helpers/jquery.fancybox-media.js
INFO  Generated: fonts/chancery/apple-chancery-webfont.woff2
INFO  Generated: fonts/chancery/apple-chancery-webfont.eot
INFO  Generated: fonts/chancery/apple-chancery-webfont.woff
INFO  Generated: lib/fancybox/helpers/jquery.fancybox-thumbs.js
INFO  Generated: js/src/even.js
INFO  Generated: 1970/01/01/hello-world/index.html
INFO  Generated: 2023/12/19/test/index.html
INFO  Generated: lib/fancybox/fancybox_loading@2x.gif
INFO  35 files generated in 767 ms
0min23s
  • hugo
    运行脚本:
h
#!/bin/bash
set -e
export A=$(date +%s)
hugo
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
Start building sites …
hugo v0.120.4+extended linux/amd64 BuildDate=unknown
ERROR render of "taxonomy" failed: "/home/user/blog-hugo/themes/even/layouts/_default/baseof.html:14:5": execute of template failed: template: _default/terms.html:14:5: executing "_default/terms.html" at <partial "head.html" .>: error calling partial: execute of template failed: html/template:partials/head.html:79:13: no such template "_internal/google_news.html"
ERROR render of "home" failed: "/home/user/blog-hugo/themes/even/layouts/_default/baseof.html:14:5": execute of template failed: template: index.html:14:5: executing "index.html" at <partial "head.html" .>: error calling partial: execute of template failed: html/template:partials/head.html:79:13: no such template "_internal/google_news.html"
Total in 906 ms
Error: error building site: render: failed to render pages: render of "taxonomy" failed: "/home/user/blog-hugo/themes/even/layouts/_default/baseof.html:14:5": execute of template failed: template: _default/terms.html:14:5: executing "_default/terms.html" at <partial "head.html" .>: error calling partial: execute of template failed: html/template:partials/head.html:79:13: no such template "_internal/google_news.html"

难绷,不过 hugo 比 hexo 快

# 附录 1: 测试环境安装 nodejs,npm 和 yarn 的耗时

运行脚本:

h
#!/bin/bash
export A=$(date +%s)
sudo apk add nodejs npm yarn
export B=$(date +%s)
export C=$(expr $B - $A)
echo "$(expr $C / 60)"min"$(expr $C % 60)"s

输出结果:

h
(1/11) Installing ca-certificates (20230506-r0)
(2/11) Installing ada-libs (2.7.4-r0)
(3/11) Installing libbase64 (0.5.0-r0)
(4/11) Installing brotli-libs (1.1.0-r1)
(5/11) Installing c-ares (1.23.0-r0)
(6/11) Installing icu-data-en (74.2-r0)
Executing icu-data-en-74.2-r0.post-install
*
* If you need ICU with non-English locales and legacy charset support, install
* package icu-data-full.
*
(7/11) Installing icu-libs (74.2-r0)
(8/11) Installing nghttp2-libs (1.58.0-r0)
(9/11) Installing nodejs (20.10.0-r1)
(10/11) Installing npm (10.2.5-r0)
(11/11) Installing yarn (1.22.19-r0)
Executing busybox-1.36.1-r17.trigger
Executing ca-certificates-20230506-r0.trigger
OK: 106 MiB in 67 packages
0min49s

# 附录 2:hexo 不用 apk add 安装的原因

h
user@localhost ~> apk add hexo
ERROR: unable to select packages:
  hexo (no such package):
    required by: world[hexo]
user@localhost ~ [1]> apk add hexo-cli
ERROR: unable to select packages:
  hexo-cli (no such package):
    required by: world[hexo-cli]

# 附录 3: 文件夹占用大小

  • hexo:
h
55M     blog-hexo/node_modules
7.5K    blog-hexo/.github
16K     blog-hexo/scaffolds
7.5K    blog-hexo/source/_posts
11K     blog-hexo/source
3.5K    blog-hexo/themes
55M     blog-hexo/
  • hugo:
h
7.5K    blog-hugo/archetypes
3.5K    blog-hugo/assets
3.5K    blog-hugo/content
3.5K    blog-hugo/data
3.5K    blog-hugo/i18n
3.5K    blog-hugo/layouts
3.5K    blog-hugo/static
3.5K    blog-hugo/themes
40K     blog-hugo
更新于 阅读次数