-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Improve build time #823
Comments
@TetraTheta made some minor improvement yesterday, now it is 1s faster than before on your site, takes 4s in total on my WSL2, didn't test on Windows, please upgrade modules via |
I can confirm that overall (re)build time decreased on my machine. Thanks for your heavy effort! I really appreciate it. You really saved my time :) Footnotes
|
Every modules are up to date at the time I write this comment. Hugo rebuilds site when any 'source file' of site is changed, and it takes some time.
That's what I call 'rebuild time'. I don't know why 'rebuild time' takes more time than 'initial build time'. The script I use for running test server is like this: [console]::WindowWidth=120
[console]::WindowHeight=30
[console]::BufferWidth=[console]::WindowWidth
# Prevent Quick Edit
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode);
}
"@
$consoleHandle = [Win32]::GetStdHandle(-10) # STD_INPUT_HANDLE: -10
$currentMode = 0
[Win32]::GetConsoleMode($consoleHandle, [ref]$currentMode) | Out-Null
$newMode = ($currentMode -band -bnot 0x0040) -bor 0x0080 # ENABLE_QUICK_EDIT_MODE: 0x0040 | ENABLE_EXTENDED_FLAGS: 0x0080
[Win32]::SetConsoleMode($consoleHandle, $newMode) | Out-Null
# Set Title
$host.ui.RawUI.WindowTitle = "TetraLog Test Server"
Set-Location -LiteralPath (Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path))
Remove-Item "public" -Recurse -ErrorAction "Ignore"
Remove-Item "resources" -Recurse -ErrorAction "Ignore"
# Fast Render: Home page + Content page last edited (if any) + Content page last visited (up to 10)
hugo server --renderToMemory --printMemoryUsage --disableFastRender -D -p 80 Oops, I just found that |
No idea, but you can remove the
|
In my case, 'Fast Render' isn't fast. Same script without |
Seems weird, fast render should be much more faster than re-render fully, you can use hugo command ( |
Running only Hugo commands without
These should not affect Hugo's performance. Since these are crucial to me, I'll just use EDIT:
I'm using Hugo v0.126.3. |
I always testing this with browser openning, it just took I have no idea on this, I'd recommend using Hugo directly, since it works expected without PS script. |
I guess I have to live with current script, because it seems that what matters is Hugo itself, not other parts of the script. I searched SO for code for disabling Quick Edit and Insert Mode and replaced my previous code that was generated with ChatGPT to it. It didn't change anything though. Other parts of the script is from SO, so I guess there is no AI-generated code problem now. In my theory, other parts of the script should not affect Hugo because they only affects PowerShell and underlying I also ran Hugo directly without I did similar test with script yesterday, but I couldn't conclude that 'it always takes 22 seconds to rebuild site in Fast Render Mode' at that time because Hugo sometimes rebuilt the site in 1~2 seconds in Fast Render Mode. I think when the change is post content change, rather than just single space diff, rebuild time seems to fluctuate between 1~2 seconds to 22 seconds, mostly 22 seconds and above. not that important thingStrange thing is, if I remember correctly, Fast Render Mode was actually faster than non-Fast Render Mode for both initial site building and rebuilding before. I can't tell which version that this weird behavior started, but I can tell it started in this year. Not very helpful information, though... I can't tell this is Hugo's problem or my environment's problem. My Windows installation is heavily modified. But I can definitely tell that this was not a problem until some point of this year. TL;DR |
No description provided.
The text was updated successfully, but these errors were encountered: