From 9d84f5c4a187a41e4eba954018c9e9b9fcc46d2e Mon Sep 17 00:00:00 2001 From: JackJ30 Date: Tue, 13 May 2025 01:51:16 -0400 Subject: emacs article --- zola-static/config.toml | 2 +- zola-static/content/about-me.md | 10 +++- zola-static/content/about-this-site.md | 8 ++- .../content/blog/emacs-garbage-collection.md | 40 +++++++++++++++ zola-static/sass/base.scss | 57 +++++++++++++++------ zola-static/static/.gitpreserve | 0 zola-static/static/images/portrait.jpg | Bin 0 -> 2940276 bytes zola-static/templates/base.html | 2 +- zola-static/templates/blog-page.html | 8 +-- zola-static/templates/index.html | 4 +- 10 files changed, 105 insertions(+), 26 deletions(-) create mode 100644 zola-static/content/blog/emacs-garbage-collection.md delete mode 100644 zola-static/static/.gitpreserve create mode 100644 zola-static/static/images/portrait.jpg diff --git a/zola-static/config.toml b/zola-static/config.toml index b5a0879..b813603 100644 --- a/zola-static/config.toml +++ b/zola-static/config.toml @@ -14,4 +14,4 @@ highlight_code = true highlight_theme = "nyx-bold" [extra] -# Put all your custom variables here +# Put all your custom variables here \ No newline at end of file diff --git a/zola-static/content/about-me.md b/zola-static/content/about-me.md index 13b4889..9eef574 100644 --- a/zola-static/content/about-me.md +++ b/zola-static/content/about-me.md @@ -3,4 +3,12 @@ title = "About Me" template = "main-page.html" +++ -My name is Jack Jamison +My name is Jack Jamison. I'm an American software engineer studying at the [Rensselaer Polytechnic Institute](https://www.rpi.edu) in New York. I've been programming since I was a little kid. + +I enjoy GPU programming, cross-platform desktop application design, build systems, game development, and system administration. I'm also interested in operating systems and networking, but I haven't pursued them yet. + +I use Emacs as my text editor. I've spent a lot of time configuring it. If you want, you can check out my [dotfiles](https://github.com/JackJ30/dotfiles). + +If you want to talk to me, I would love to also. Feel to reach out at my [email](mailto:jackqjamison@gmail.com). + +![Handsome devil](/images/portrait.jpg) diff --git a/zola-static/content/about-this-site.md b/zola-static/content/about-this-site.md index ec41a95..b8b6499 100644 --- a/zola-static/content/about-this-site.md +++ b/zola-static/content/about-this-site.md @@ -3,4 +3,10 @@ title = "About This Site" template = "main-page.html" +++ -This site is generated with [zola](https://getzola.org). +# About this website +- The pages are generated from markdown files with [Zola](https://getzola.org). +- I use [Nginx](https://https://nginx.org/) as my web server. +- It is hosted on [Vultr](https://www.vultr.com/). +- [Epik](https://epik.com) is my domain registrar. + +There are no ads or trackers on this site. The source code is available on [github](https://github.com/JackJ30/jackjamison.xyz). diff --git a/zola-static/content/blog/emacs-garbage-collection.md b/zola-static/content/blog/emacs-garbage-collection.md new file mode 100644 index 0000000..1784be9 --- /dev/null +++ b/zola-static/content/blog/emacs-garbage-collection.md @@ -0,0 +1,40 @@ ++++ +title = "Solving Emacs Garbage Collection Stutters" +date = 2025-05-12 ++++ + +The more you load Emacs up with packages, the more it starts to show its age. Throw on a theme and an lsp client, and you might start to notice frequent stuttering. + +This problem was very frustrating for me - I dealt with it for months, and considered quitting Emacs altogether. I want to be able to hold `C-n` and linearly move down the document, micro-stutter *free*. + + +# Garbage Collection +It turns out that the problem wasn't that packages were executing slowly, it was the garbage that they were building up. Emacs' garbage collector waits until a byte threshold has been reached before executing. +> This value feels relatively low for a modern computer - only `800KB`. + +Once threshold is reached the garbage collection process takes time, and causes the stutter. If you want to see just how often this triggers the GC, try setting `garbage-collection-messages` to non nil (you might be surprised how often it triggers). As with most things in Emacs, you can tune this behaviour. + +Opinions differ. +- Some people recommend **increasing** the threshold, leading to longer times without triggering the GC but longer stutters. +- Others recommend **lowering** the threshold, causing more frequent GC triggers but smaller stutters. +- The minibuffer (especially with packages like `vertico`) can use a lot of memory, so some [recommend](https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/) increasing the threshold only when using it. + +# The Solution +In my opinion, the best solution is to garbage collect **when idle**. When editing, you're often pausing briefly - and if there is little garbage, Emacs can collect it very quickly. +I also *basically* disable the threshold entirely when in the minibuffer. Here's the code from my `init.el`. + +```lisp +(defun my-minibuffer-setup-hook () + (setq gc-cons-threshold most-positive-fixnum)) + +(defun my-minibuffer-exit-hook () + (setq gc-cons-threshold 800000000)) + +(setq gc-cons-threshold most-positive-fixnum) + +(run-with-idle-timer 1.2 t 'garbage-collect) +``` + +I have been using this for a few months and it's worked perfectly. Even when I try my best to notice the garbage collection, I can't. + +> There is a package which does the same thing, called [the Garbage Collector Magic Hack](https://github.com/emacsmirror/gcmh). Personally I prefer a lower idle time, and keeping it in my own config. diff --git a/zola-static/sass/base.scss b/zola-static/sass/base.scss index 8090930..7b84bb8 100644 --- a/zola-static/sass/base.scss +++ b/zola-static/sass/base.scss @@ -1,22 +1,19 @@ -* { - font-family: monospace; -} - body { background-color: #252422; margin: 0; padding: 0; + font-family: arial; } body section { height: 100%; - max-width: 75rem; + max-width: 55rem; margin-inline: auto; padding: 1rem; background-color: #252422; color: #F3E9DC; - font-size: 125%; + font-size: 115%; } // text sizing @@ -30,7 +27,7 @@ ul { p { margin-top: 0.5rem; - margin-bottom: 0.5rem; + margin-bottom: 1.2rem; } a { @@ -41,25 +38,38 @@ h1 a { text-decoration: none; } -pre { - padding : 0.5rem; - border-radius: 0.3rem; - overflow: auto; - tab-size: 4; -} - .header-title { margin-bottom: 0; font-size: 2.5rem; } +.blog-header { + display: flex; + justify-content: space-between; +} + +.blog-header-left { + padding-right: 1rem; + flex: 1 1 auto; + max-width: 60%; +} + +.blog-header-right { + flex: 0 0 auto; + white-space: nowrap; + text-align: right; +} + .subtitle { margin: 0.5rem auto; } -.header-container { - display: flex; - justify-content: space-between; +pre { + padding : 0.5rem; + border-radius: 0.3rem; + overflow: auto; + tab-size: 4; + font-family: monospace; } .footer-text { @@ -78,3 +88,16 @@ blockquote p { margin-top: 0.2rem; margin-bottom: 0.2rem; } + +p code { + background: #171615; + padding-left: 0.5rem; + padding-right: 0.5rem; + font-family: monospace; +} + +img { + width: 40rem; + display: block; + margin: 0 auto; +} diff --git a/zola-static/static/.gitpreserve b/zola-static/static/.gitpreserve deleted file mode 100644 index e69de29..0000000 diff --git a/zola-static/static/images/portrait.jpg b/zola-static/static/images/portrait.jpg new file mode 100644 index 0000000..85fd2e4 Binary files /dev/null and b/zola-static/static/images/portrait.jpg differ diff --git a/zola-static/templates/base.html b/zola-static/templates/base.html index 9aa47d8..7eb1914 100644 --- a/zola-static/templates/base.html +++ b/zola-static/templates/base.html @@ -3,7 +3,7 @@ - Jack Jamison + {% block title %}Jack Jamison{% endblock title %} diff --git a/zola-static/templates/blog-page.html b/zola-static/templates/blog-page.html index 8e2fa3d..ed1afeb 100644 --- a/zola-static/templates/blog-page.html +++ b/zola-static/templates/blog-page.html @@ -1,14 +1,16 @@ {% extends "base.html" %} +{% block title %}{{ page.title }}{% endblock title %} + {% block header %} -
-
+
+

{{ page.title }}

{{ page.date }} {% if page.updated %} (updated {{ page.updated }}) {% endif %}

-
+
diff --git a/zola-static/templates/index.html b/zola-static/templates/index.html index f674f13..4ef333d 100644 --- a/zola-static/templates/index.html +++ b/zola-static/templates/index.html @@ -8,12 +8,12 @@

Articles

Links


-- cgit v1.2.3