feat: parallel hashing
This commit is contained in:
parent
d6034633bf
commit
0974abc81d
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1593,6 +1593,7 @@ dependencies = [
|
||||||
"npezza93-tree-sitter-nix",
|
"npezza93-tree-sitter-nix",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pulldown-cmark",
|
"pulldown-cmark",
|
||||||
|
"rayon",
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"sha256",
|
"sha256",
|
||||||
|
|
|
@ -16,6 +16,7 @@ hypertext = "0.5.1"
|
||||||
image = "0.24.0"
|
image = "0.24.0"
|
||||||
katex = "0.4.6"
|
katex = "0.4.6"
|
||||||
once_cell = "1.19.0"
|
once_cell = "1.19.0"
|
||||||
|
rayon = "1.10.0"
|
||||||
regex = "1.10.5"
|
regex = "1.10.5"
|
||||||
serde = { version = "1.0.203", features = ["derive"] }
|
serde = { version = "1.0.203", features = ["derive"] }
|
||||||
sha256 = "1.5.0"
|
sha256 = "1.5.0"
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
---
|
|
||||||
title: A visit to Sejm
|
|
||||||
date: 2023-11-14T20:37:28.283Z
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231110_125448.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231110_125640.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_112524.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_112655.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_112708.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_113421.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_113641.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_114027.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_114532.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_114547.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_114717.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_114731.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_115145.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_115155.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_115219.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_115223.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_120050.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_120845.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_120954.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_121205.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_121336.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_121618.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_122703.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_122706.jpg)
|
|
||||||
|
|
||||||
![a](@assets/posts/sejm/IMG_20231111_124915.jpg)
|
|
||||||
|
|
56
content/posts/sejm/index.md
Normal file
56
content/posts/sejm/index.md
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
---
|
||||||
|
title: A visit to Sejm
|
||||||
|
date: 2023-11-14T20:37:28.283Z
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
![a](IMG_20231110_125448.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231110_125640.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_112524.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_112655.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_112708.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_113421.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_113641.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_114027.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_114532.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_114547.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_114717.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_114731.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_115145.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_115155.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_115219.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_115223.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_120050.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_120845.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_120954.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_121205.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_121336.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_121618.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_122703.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_122706.jpg)
|
||||||
|
|
||||||
|
![a](IMG_20231111_124915.jpg)
|
||||||
|
|
|
@ -34,7 +34,7 @@ I've decided to ditch fully-featured IDEs such as IntelliJ and lighter editors s
|
||||||
|
|
||||||
I also like the fact that the entire config for Neovim can be stored in a git repository. I uploaded mine to a [GitHub repository](https://github.com/kamoshi/dotfiles/tree/main/nvim) for anyone curious. You can use Lua to configure this editor instead of Vimscript, which is pretty cool, I like Lua.
|
I also like the fact that the entire config for Neovim can be stored in a git repository. I uploaded mine to a [GitHub repository](https://github.com/kamoshi/dotfiles/tree/main/nvim) for anyone curious. You can use Lua to configure this editor instead of Vimscript, which is pretty cool, I like Lua.
|
||||||
|
|
||||||
![Neovim screengrab](@assets/posts/neovim.png)
|
![Neovim screengrab](neovim.png)
|
||||||
|
|
||||||
|
|
||||||
## Arch Linux
|
## Arch Linux
|
||||||
|
@ -53,7 +53,7 @@ On top of all that, Arch Linux is a rolling release distro, which means that eve
|
||||||
|
|
||||||
Below is an obligatory neofetch screenshot.
|
Below is an obligatory neofetch screenshot.
|
||||||
|
|
||||||
![Obligatory neofetch screengrab](@assets/posts/arch.png)
|
![Obligatory neofetch screengrab](arch.png)
|
||||||
|
|
||||||
|
|
||||||
For some time I probably won't be writing anything new in here. It's really ironic, but now that I do have a lot of time, I don't really have anything interesting to write about. I have a ton of things to do, which I couldn't really do while I was studying full time at a university.
|
For some time I probably won't be writing anything new in here. It's really ironic, but now that I do have a lot of time, I don't really have anything interesting to write about. I have a ton of things to do, which I couldn't really do while I was studying full time at a university.
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
title: Touhou meetups
|
|
||||||
---
|
|
||||||
|
|
||||||
## Remcon 2022
|
|
||||||
|
|
||||||
![Blackboard art and flag](../../assets/wiki/touhouroom/20220226-173752_1.jpg)
|
|
||||||
|
|
||||||
## Remcon 2023
|
|
||||||
|
|
||||||
![Fumos](../../assets/wiki/touhouroom/IMG_20230225_185115.jpg)
|
|
||||||
|
|
||||||
## Fantasmagoria 2023
|
|
||||||
|
|
||||||
![Blackboard art](../../assets/wiki/touhouroom/IMG_20230716_092353.jpg)
|
|
||||||
![Whiteboard art](../../assets/wiki/touhouroom/IMG_20230716_092402.jpg)
|
|
||||||
|
|
17
content/wiki/touhouroom/index.md
Normal file
17
content/wiki/touhouroom/index.md
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
title: Touhou meetups
|
||||||
|
---
|
||||||
|
|
||||||
|
## Remcon 2022
|
||||||
|
|
||||||
|
![Blackboard art and flag](20220226-173752_1.jpg)
|
||||||
|
|
||||||
|
## Remcon 2023
|
||||||
|
|
||||||
|
![Fumos](IMG_20230225_185115.jpg)
|
||||||
|
|
||||||
|
## Fantasmagoria 2023
|
||||||
|
|
||||||
|
![Blackboard art](IMG_20230716_092353.jpg)
|
||||||
|
![Whiteboard art](IMG_20230716_092402.jpg)
|
||||||
|
|
|
@ -7,6 +7,7 @@ use std::path::Path;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use camino::{Utf8Path, Utf8PathBuf};
|
use camino::{Utf8Path, Utf8PathBuf};
|
||||||
|
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
||||||
|
|
||||||
use crate::pipeline::{AssetKind, Output, OutputKind, Sack, Virtual};
|
use crate::pipeline::{AssetKind, Output, OutputKind, Sack, Virtual};
|
||||||
use crate::BuildContext;
|
use crate::BuildContext;
|
||||||
|
@ -134,7 +135,7 @@ fn store_hash(buffer: &[u8]) -> Utf8PathBuf {
|
||||||
|
|
||||||
pub(crate) fn store_hash_all(items: &[&Output]) -> Vec<Hashed> {
|
pub(crate) fn store_hash_all(items: &[&Output]) -> Vec<Hashed> {
|
||||||
items
|
items
|
||||||
.iter()
|
.par_iter()
|
||||||
.filter_map(|item| match item.kind {
|
.filter_map(|item| match item.kind {
|
||||||
OutputKind::Asset(ref asset) => match asset.kind {
|
OutputKind::Asset(ref asset) => match asset.kind {
|
||||||
AssetKind::Image => {
|
AssetKind::Image => {
|
||||||
|
|
|
@ -248,7 +248,7 @@ where
|
||||||
|
|
||||||
fn process_content<T>(item: PipelineItem) -> PipelineItem
|
fn process_content<T>(item: PipelineItem) -> PipelineItem
|
||||||
where
|
where
|
||||||
T: for<'de> Deserialize<'de> + Content + Clone + 'static,
|
T: for<'de> Deserialize<'de> + Content + Clone + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
let meta = match item {
|
let meta = match item {
|
||||||
PipelineItem::Skip(e) if matches!(e.kind, FileItemKind::Index) => e,
|
PipelineItem::Skip(e) if matches!(e.kind, FileItemKind::Index) => e,
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub(crate) struct FileItem {
|
||||||
/// Marks how the asset should be processed by the SSG.
|
/// Marks how the asset should be processed by the SSG.
|
||||||
pub(crate) enum AssetKind {
|
pub(crate) enum AssetKind {
|
||||||
/// Data renderable to HTML. In order to process the data, a closure should be called.
|
/// Data renderable to HTML. In order to process the data, a closure should be called.
|
||||||
Html(Box<dyn Fn(&Sack) -> String>),
|
Html(Box<dyn Fn(&Sack) -> String + Send + Sync>),
|
||||||
/// Bibliographical data.
|
/// Bibliographical data.
|
||||||
Bibtex(Library),
|
Bibtex(Library),
|
||||||
/// Image. For now they are simply cloned to the `dist` director.
|
/// Image. For now they are simply cloned to the `dist` director.
|
||||||
|
@ -87,7 +87,7 @@ impl Debug for AssetKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AssetKind {
|
impl AssetKind {
|
||||||
pub fn html(f: impl Fn(&Sack) -> String + 'static) -> Self {
|
pub fn html(f: impl Fn(&Sack) -> String + Send + Sync + 'static) -> Self {
|
||||||
Self::Html(Box::new(f))
|
Self::Html(Box::new(f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,10 +103,10 @@ pub(crate) struct Asset {
|
||||||
|
|
||||||
/// Dynamically generated asset not corresponding to any file on disk. This is useful when the
|
/// Dynamically generated asset not corresponding to any file on disk. This is useful when the
|
||||||
/// generated page is not a content page, e.g. page list.
|
/// generated page is not a content page, e.g. page list.
|
||||||
pub(crate) struct Virtual(pub Box<dyn Fn(&Sack) -> String>);
|
pub(crate) struct Virtual(pub Box<dyn Fn(&Sack) -> String + Send + Sync>);
|
||||||
|
|
||||||
impl Virtual {
|
impl Virtual {
|
||||||
pub fn new(call: impl Fn(&Sack) -> String + 'static) -> Self {
|
pub fn new(call: impl Fn(&Sack) -> String + Send + Sync + 'static) -> Self {
|
||||||
Self(Box::new(call))
|
Self(Box::new(call))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue