docs(twitter): add 1948009807161721332 corpus (NOTimothyLottes single-file-C + mmap log dev setup)

13-post thread with @Karyuuntei. Single-source C includes only __FILE__;
WIN32 + VK headers inlined with structural-type rewrites (64-bit ints
not pointers) to get 'toward C--'. GLSL and C mixed in same file,
sharing defines. One external include for compiled SPIR-V; spirv-opt
as pre-processor (else IHV compilers 10x slower). Dev setup: 2
terminals each with own shell script, one loops regenerating SPIR-V,
other loops recompiling+running. MINGW64 not VS. Mmap log format:
{[restart]|[ms]|[line]|[hex]|[dec]|[comment]}, fixed-size lines,
lock-free (one atomic add), wraps, clear = rm. 0.3ms startup.
This commit is contained in:
ed
2026-07-27 00:20:04 -04:00
parent 1dbcafd8c2
commit df60414c98
7 changed files with 301 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

@@ -0,0 +1,77 @@
---
title: "@Karyuutensei I don't use standard C libs or anything like that. I just write my"
author: "NOTimothyLottes"
handle: "@NOTimothyLottes"
post_url: "https://x.com/NOTimothyLottes/status/1948009807161721332"
post_id: "1948009807161721332"
timestamp: "2025-07-23 13:18:24"
post_count: 13
reply_count: 2
repost_count: 0
like_count: 4
view_count: 322
---
# @NOTimothyLottes — @Karyuutensei I don't use standard C libs or anything like that. I just write my
## Post 1 (2025-07-23 02:36:34)
"nobody self includes with defines to reorder C code" ... Haha, apparently I'm not the only one, the File Pilot guy does it too :)
![Media 1](./media/1947848281280631267_1.png)
## Post 2 (2025-07-23 07:14:41) — reply to Post 1
@NOTimothyLottes Do you also automatically generate the include files or do you just write them yourself?
## Post 3 (2025-07-23 12:48:28) — reply to Post 2
@Karyuutensei I only include __FILE__ (self). For WIN32 and VK even, I recreate the parts of external headers I need (use) inside the 'one source file', typically with structural type changes to switch back to simple types like 64 bit intergers instead of pointers. Trying to get to C--
## Post 4 (2025-07-23 12:54:01) — reply to Post 3
@Karyuutensei One side effect, even with C code the compilation is perceptually instant for the whole program. The other thing I do is mix the GLSL and C all in the same file, so I share defines. I do have one external include for the compiled SPIR-V ...
## Post 5 (2025-07-23 12:57:52) — reply to Post 4
@Karyuutensei For the SPIR-V, I also have one program, but I use specialization constants set at PSO generation to select the code path for a specific 'shader'. This requires spriv opt as a pre-processor else the IHV compilers tend to be 10x or more slower.
## Post 6 (2025-07-23 13:06:29) — reply to Post 5
@Karyuutensei During dev time I use 2 terminals each with their own shell scripts. The first is to just loop and keep regenerating the SPIR-V if anything in the 'one file' changes. This is unfortunately a mess to do in a batch file (below)
![Media 1](./media/1948006808284500326_1.png)
## Post 7 (2025-07-23 13:11:04) — reply to Post 6
@Karyuutensei The second does the same for the C program, loops recompiling and running the program. So when I'm editing source I can just fast exit the program and it restarts [with instant restart/reload it is quite fast to restart]
![Media 1](./media/1948007959134392704_1.png)
## Post 8 (2025-07-23 13:12:55) — reply to Post 7
@Karyuutensei I'm using GCC on Windows, because why bother with having to install Visual Studio or it's compiler tool chain mess. I just do MINGW64 and be done with it. My debugger is the instant restart for C code, and shader reload for GLSL
## Post 9 (2025-07-23 13:18:24) — reply to Post 8
@Karyuutensei I don't use standard C libs or anything like that. I just write my own stuff. For 'printf' style debugging I have macros that write to a memory mapped log file. They give {[restartNumber]|[msSinceLaunch]|[sourceLine]|[hex]|[dec]|[comment]}. Keeping multiple restarts in same log
![Media 1](./media/1948009807161721332_1.png)
## Post 10 (2025-07-23 13:22:24) — reply to Post 9
@Karyuutensei That log example is a simple test program, it starts in 0.3 ms for that run. The log tells all about how it pipelines start up {doing memory page warming, kart load, window setup, VK setup in parallel, getting to PSO gen as fast as possible [get layout done first]}
![Media 1](./media/1948010813555634392_1.png)
## Post 11 (2025-07-23 16:09:16) — reply to Post 9
@NOTimothyLottes Where does the restart number come from? I assume this is how many times you exited the code and started again automatically using your batch script?
## Post 12 (2025-07-23 16:14:55) — reply to Post 11
@Karyuutensei Yeah exactly that. The log file is a fixed size, and memory mapped (+page warming), and lines are a fixed size, so writing a message is lock free (fast just one atomic add, no file or system calls). When it fills it wraps around, and to clear just delete the file (it recreates it
## Post 13 (2025-07-23 20:14:13) — reply to Post 12
@NOTimothyLottes Thanks for sharing. Ive never thought of doing logging like this.
@@ -0,0 +1,224 @@
{
"root_post_id": "1948009807161721332",
"posts": [
{
"post_id": "1947848281280631267",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "\"nobody self includes with defines to reorder C code\" ... Haha, apparently I'm not the only one, the File Pilot guy does it too :)",
"timestamp": "2025-07-23 02:36:34",
"media_urls": [
"https://pbs.twimg.com/media/GwgkzCMWsAAnfS7?format=png&name=orig"
],
"reply_to_id": null,
"quote_of_id": null,
"metrics": {
"reply_count": 3,
"repost_count": 3,
"like_count": 43,
"view_count": 3416
}
},
{
"post_id": "1947918274764657130",
"author": "Nick Tasios",
"handle": "Karyuutensei",
"text": "@NOTimothyLottes Do you also automatically generate the include files or do you just write them yourself?",
"timestamp": "2025-07-23 07:14:41",
"media_urls": [],
"reply_to_id": "1947848281280631267",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 0,
"view_count": 387
}
},
{
"post_id": "1948002273352634482",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei I only include __FILE__ (self). For WIN32 and VK even, I recreate the parts of external headers I need (use) inside the 'one source file', typically with structural type changes to switch back to simple types like 64 bit intergers instead of pointers. Trying to get to C--",
"timestamp": "2025-07-23 12:48:28",
"media_urls": [],
"reply_to_id": "1947918274764657130",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 1,
"like_count": 1,
"view_count": 434
}
},
{
"post_id": "1948003669942952024",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei One side effect, even with C code the compilation is perceptually instant for the whole program. The other thing I do is mix the GLSL and C all in the same file, so I share defines. I do have one external include for the compiled SPIR-V ...",
"timestamp": "2025-07-23 12:54:01",
"media_urls": [],
"reply_to_id": "1948002273352634482",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 1,
"view_count": 200
}
},
{
"post_id": "1948004638344573135",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei For the SPIR-V, I also have one program, but I use specialization constants set at PSO generation to select the code path for a specific 'shader'. This requires spriv opt as a pre-processor else the IHV compilers tend to be 10x or more slower.",
"timestamp": "2025-07-23 12:57:52",
"media_urls": [],
"reply_to_id": "1948003669942952024",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 1,
"view_count": 190
}
},
{
"post_id": "1948006808284500326",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei During dev time I use 2 terminals each with their own shell scripts. The first is to just loop and keep regenerating the SPIR-V if anything in the 'one file' changes. This is unfortunately a mess to do in a batch file (below)",
"timestamp": "2025-07-23 13:06:29",
"media_urls": [
"https://pbs.twimg.com/media/Gwi1pOOW4AEZDE5?format=png&name=orig"
],
"reply_to_id": "1948004638344573135",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 2,
"view_count": 204
}
},
{
"post_id": "1948007959134392704",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei The second does the same for the C program, loops recompiling and running the program. So when I'm editing source I can just fast exit the program and it restarts [with instant restart/reload it is quite fast to restart]",
"timestamp": "2025-07-23 13:11:04",
"media_urls": [
"https://pbs.twimg.com/media/Gwi23Q9WMAI4Grm?format=png&name=orig"
],
"reply_to_id": "1948006808284500326",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 2,
"view_count": 206
}
},
{
"post_id": "1948008427080253547",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei I'm using GCC on Windows, because why bother with having to install Visual Studio or it's compiler tool chain mess. I just do MINGW64 and be done with it. My debugger is the instant restart for C code, and shader reload for GLSL",
"timestamp": "2025-07-23 13:12:55",
"media_urls": [],
"reply_to_id": "1948007959134392704",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 1,
"view_count": 261
}
},
{
"post_id": "1948009807161721332",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei I don't use standard C libs or anything like that. I just write my own stuff. For 'printf' style debugging I have macros that write to a memory mapped log file. They give {[restartNumber]|[msSinceLaunch]|[sourceLine]|[hex]|[dec]|[comment]}. Keeping multiple restarts in same log",
"timestamp": "2025-07-23 13:18:24",
"media_urls": [
"https://pbs.twimg.com/media/Gwi4H27WgAAIgMN?format=png&name=orig"
],
"reply_to_id": "1948008427080253547",
"quote_of_id": null,
"metrics": {
"reply_count": 2,
"repost_count": 0,
"like_count": 4,
"view_count": 322
}
},
{
"post_id": "1948010813555634392",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei That log example is a simple test program, it starts in 0.3 ms for that run. The log tells all about how it pipelines start up {doing memory page warming, kart load, window setup, VK setup in parallel, getting to PSO gen as fast as possible [get layout done first]}",
"timestamp": "2025-07-23 13:22:24",
"media_urls": [
"https://pbs.twimg.com/media/Gwi47owXQAEa2Ar?format=png&name=orig"
],
"reply_to_id": "1948009807161721332",
"quote_of_id": null,
"metrics": {
"reply_count": 0,
"repost_count": 0,
"like_count": 2,
"view_count": 188
}
},
{
"post_id": "1948052805647782109",
"author": "Nick Tasios",
"handle": "Karyuutensei",
"text": "@NOTimothyLottes Where does the restart number come from? I assume this is how many times you exited the code and started again automatically using your batch script?",
"timestamp": "2025-07-23 16:09:16",
"media_urls": [],
"reply_to_id": "1948009807161721332",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 0,
"view_count": 83
}
},
{
"post_id": "1948054228762574858",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "@Karyuutensei Yeah exactly that. The log file is a fixed size, and memory mapped (+page warming), and lines are a fixed size, so writing a message is lock free (fast just one atomic add, no file or system calls). When it fills it wraps around, and to clear just delete the file (it recreates it",
"timestamp": "2025-07-23 16:14:55",
"media_urls": [],
"reply_to_id": "1948052805647782109",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 1,
"view_count": 140
}
},
{
"post_id": "1948114448465465400",
"author": "Nick Tasios",
"handle": "Karyuutensei",
"text": "@NOTimothyLottes Thanks for sharing. Ive never thought of doing logging like this.",
"timestamp": "2025-07-23 20:14:13",
"media_urls": [],
"reply_to_id": "1948054228762574858",
"quote_of_id": null,
"metrics": {
"reply_count": 0,
"repost_count": 0,
"like_count": 1,
"view_count": 61
}
}
],
"source_url": "https://x.com/NOTimothyLottes/status/1948009807161721332"
}