Skip to content

Commit

Permalink
Improve content map, memory cache and dependency resolution
Browse files Browse the repository at this point in the history
TODO(bep) improve commit message.

Hugo has always been a active user of in-memory caches, but before this commit we did nothing to control the memory usage.

One failing example would be loading lots of big JSON data files and unmarshal them via `transform.Unmarshal`.

This commit consolidates all these caches into one single LRU cache with an eviction strategy that also considers used vs. available memory.

Hugo will try to limit its memory usage to 1/4 or total system memory, but this can be controlled with the `HUGO_MEMORYLIMIT` environment variable (a float value representing Gigabytes).

A natural next step after this would be to use this cache for `.Content`.

Fixes gohugoio#8307
Fixes gohugoio#8498
Fixes gohugoio#8927
Fixes gohugoio#9192
Fixes gohugoio#9189
Fixes gohugoio#7425
Fixes gohugoio#7437
Fixes gohugoio#7436
Fixes gohugoio#7882
Updates gohugoio#7544
Fixes gohugoio#9224
  • Loading branch information
bep committed Dec 1, 2021
1 parent 5e0947c commit 41c66da
Show file tree
Hide file tree
Showing 145 changed files with 6,816 additions and 5,173 deletions.
37 changes: 0 additions & 37 deletions bench.sh

This file was deleted.

12 changes: 0 additions & 12 deletions benchSite.sh

This file was deleted.

2 changes: 1 addition & 1 deletion benchbep.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gobench -package=./hugolib -bench="BenchmarkSiteNew/Deep_content_tree"
gobench --package ./hugolib --bench "BenchmarkSiteNew/Regular_Deep" -base v0.89.4
1 change: 0 additions & 1 deletion bepdock.sh

This file was deleted.

Loading

0 comments on commit 41c66da

Please sign in to comment.