Very slow

Hello,

I have a very few pages so why Hugo is so slow ?

hugo server :

               | FR  | EN   

-------------------±----±-----
Pages | 107 | 318
Paginator pages | 1 | 9
Non-page files | 0 | 0
Static files | 192 | 192
Processed images | 0 | 0
Aliases | 6 | 37
Sitemaps | 1 | 1
Cleaned | 0 | 0

Built in 12829 ms

And in the browser at localhost when i click a link i have to wait seconds before the page is loaded. After it is cached and fastest.

Hugo is : Hugo Static Site Generator v0.71.0/extended linux/amd64 BuildDate: unknown

I don’t know. I would need to see the site source to tell you. But I suspect you have some ineffective template constructs somewhere.

Try to run with

hugo --templateMetrics  --templateMetricsHints

And see if you get some … hints.

Building sites … 
Template Metrics:

      cache     cumulative       average       maximum         
  potential       duration      duration      duration  count  template
      -----     ----------      --------      --------  -----  --------
        32 12.255291361s   28.700916ms  1.976681302s    427  partials/header.html
          0  3.955676926s  988.919231ms  1.975676256s      4  _default/single.html
          0  3.186490802s  1.593245401s  2.545258484s      2  _default/search.json
          0  2.349563054s   40.509707ms  1.974700212s     58  blog/single.html
          0    1.9777119s   988.85595ms  1.976402952s      2  _default/logiciels.html
          0   1.97746987s  988.734935ms  1.977017687s      2  _default/contact.html
          0  1.973681904s  986.840952ms  1.973158678s      2  _default/motsmeles.html
          0  454.313241ms    1.376706ms   56.658909ms    330  tag/list.html
          0    86.84748ms     7.23729ms   66.935413ms     12  blog/list.html
          0    9.393228ms    4.696614ms    5.580535ms      2  _internal/_default/sitemap.xml
          0    8.493226ms    1.415537ms     4.59902ms      6  _internal/_default/rss.xml
          0     6.95371ms      46.358µs    2.678809ms    150  shortcodes/img.html
          0    2.679366ms     178.624µs     366.471µs     15  archives/list.html
        100    1.557915ms       3.648µs      44.839µs    427  partials/footer.html
          0     920.861µs      21.415µs     254.878µs     43  _internal/alias.html
          0     382.428µs      63.738µs     241.323µs      6  _internal/shortcodes/ref.html
          0     370.757µs     185.378µs     222.807µs      2  index.html
        100     303.337µs         713ns      62.278µs    425  partials/imgtop.html
          0     226.477µs      75.492µs     155.419µs      3  _internal/shortcodes/youtube.html
          0     215.049µs      35.841µs      64.636µs      6  _internal/shortcodes/relref.html
          0     163.813µs     163.813µs     163.813µs      1  _internal/shortcodes/tweet.html
          0     138.227µs      23.037µs       70.51µs      6  _internal/shortcodes/gist.html


                  | FR  | EN   
-------------------+-----+------
  Pages            | 107 | 318  
  Paginator pages  |   1 |   9  
  Non-page files   |   0 |   0  
  Static files     | 192 | 192  
  Processed images |   0 |   0  
  Aliases          |   6 |  37  
  Sitemaps         |   1 |   1  
  Cleaned          |   0 |   0  

Total in 5390 ms

Your header partial looks suspicious, but again, it’s impossible to guess without seeing the source.

layouts/baseof.html is :

{{ partial "header.html" . }}
{{ partial "imgtop.html" . }}
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }}

partial/header.html is :

<!DOCTYPE html>
<html lang="{{ .Language.Lang }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>{{ .Site.Title }}{{ with .Params.Title }} | {{ . }}{{ end }}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="shortcut icon" sizes="16x16 24x24 32x32" href="{{ .Site.BaseURL }}/favicon.ico">
    
    {{ if .Params.Mydescription -}}<meta name="description" content="{{ .Params.Mydescription }}" />
    {{- else if .Summary -}}<meta name="description" content="{{ replace (truncate 290 .Summary) "\n" "" | safeHTML }}" />{{- end }}
    {{ if .Params.Tags }}<meta name="keywords" content="{{ delimit .Params.tags "," }}" />{{ end }}
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@JeffProd" />

    <meta property="og:title" content="{{ .Title}}" />
    {{ if .Params.Mydescription -}}<meta property="og:description" content="{{ .Params.Mydescription }}" />
    {{- else if .Summary -}}<meta property="og:description" content="{{ replace (truncate 290 .Summary) "\n" "" | safeHTML }}" />{{- end }}
    <meta property="og:image" content="{{ if .Params.Bgimg }}{{ (print "img/" .Params.Bgimg) | absURL }}{{ else }}{{ "img/bg-blog.jpg" | absURL }}{{ end }}" />
    <meta property="og:url" content="{{ .Permalink | absURL }}" />
    <meta property="og:site_name" content="{{ .Site.Title }}" />
    <meta property="og:type" content="website" />

    {{ $css := resources.Get "css/bundle.css" | resources.PostCSS (dict "config" "assets/css/postcss.config.js" "noMap" true) | minify }}
    <link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}">

    {{- range .AlternativeOutputFormats }}
    <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
    {{ end -}}
</head>
<body class="bg-gray-800 text-white">

Thanks for your help.