mirror of
https://github.com/sbrow/thor.git
synced 2026-08-26 11:23:32 -04:00
perf(site): Stored pages using #soa.
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
- [ ] Only publish referenced assets.
|
- [ ] Only publish referenced assets.
|
||||||
- [ ] Split `load_page` into frontmatter-parse + body-process phases so draft pages can skip the markdown pipeline entirely
|
- [ ] Split `load_page` into frontmatter-parse + body-process phases so draft pages can skip the markdown pipeline entirely
|
||||||
- [ ] Use spall to find ways to reduce run time.
|
- [ ] Use spall to find ways to reduce run time.
|
||||||
- [ ] Consider using `#soa` for Page lists.
|
- [x] Consider using `#soa` for Page lists.
|
||||||
- [ ] too many `write_string` calls in `highlight_block`
|
- [ ] too many `write_string` calls in `highlight_block`
|
||||||
- [ ] return `src: cstring` from `load_query`.
|
- [ ] return `src: cstring` from `load_query`.
|
||||||
- [ ] Improve `unescape_html` with simd.
|
- [ ] Improve `unescape_html` with simd.
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ Pending_File :: struct {
|
|||||||
// site_load_content reads the content directory and populates site.pages.
|
// site_load_content reads the content directory and populates site.pages.
|
||||||
// Drafts are excluded unless .Drafts is enabled.
|
// Drafts are excluded unless .Drafts is enabled.
|
||||||
site_load_content :: proc(site: ^Site) {
|
site_load_content :: proc(site: ^Site) {
|
||||||
site.pages = make([dynamic]Page, 0, 8, site_allocator(site))
|
site.pages = make(#soa[dynamic]Page, 0, 8, site_allocator(site))
|
||||||
|
|
||||||
// Phase 0: Enumerate content files
|
// Phase 0: Enumerate content files
|
||||||
pending := make([dynamic]Pending_File, 0, 16, context.temp_allocator)
|
pending := make([dynamic]Pending_File, 0, 16, context.temp_allocator)
|
||||||
|
|||||||
+2
-2
@@ -393,11 +393,11 @@ get_year :: proc(iso: string) -> string {
|
|||||||
return iso[:4]
|
return iso[:4]
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_pages_by_date :: proc(pages: []Page) {
|
sort_pages_by_date :: proc(pages: #soa[]Page) {
|
||||||
for i in 1 ..< len(pages) {
|
for i in 1 ..< len(pages) {
|
||||||
key := pages[i]
|
key := pages[i]
|
||||||
j := i - 1
|
j := i - 1
|
||||||
for j >= 0 && pages[j].date < key.date {
|
for j >= 0 && pages.date[j] < key.date {
|
||||||
pages[j + 1] = pages[j]
|
pages[j + 1] = pages[j]
|
||||||
j -= 1
|
j -= 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import md "markdown"
|
|||||||
// Site is the primary workhorse.
|
// Site is the primary workhorse.
|
||||||
Site :: struct {
|
Site :: struct {
|
||||||
arena: mem.Dynamic_Arena,
|
arena: mem.Dynamic_Arena,
|
||||||
pages: [dynamic]Page,
|
pages: #soa[dynamic]Page,
|
||||||
modules: [dynamic]string,
|
modules: [dynamic]string,
|
||||||
vfs: VFS,
|
vfs: VFS,
|
||||||
title: string,
|
title: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user