Karan's Avatar

Karan

@kmj007.bsky.social

your friendly neighborhood nerd https://blog.karanjanthe.me

12 Followers  |  69 Following  |  41 Posts  |  Joined: 04.03.2025  |  1.5812

Latest posts by kmj007.bsky.social on Bluesky

Enter The Arena: Simplifying Memory Management (2023)
YouTube video by Ryan Fleury Enter The Arena: Simplifying Memory Management (2023)

good talk:

www.youtube.com/watch?v=TZ5a...

31.10.2025 11:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

My bytebeat was not working on the web because I was parsing the expression on every sample rate, like 8000 times per second, and it was slow for generating the value for audio buffers, which is why audio was cracking up, but running great in the desktop app

I actually used arena allocator properly

31.10.2025 10:27 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

const std = @import("std");

pub fn main() !void {
std.debug.print("{d}\n", .{@sizeOf(User)});
}

const User = struct {
id: u32,
name: []const u8,
};

The answer here is 24, not 20, cause 4 bytes are added for padding

30.10.2025 07:40 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

So the size of a struct is padded to a multiple of its alignment, which is defined as the largest alignment requirement of any of its fields

30.10.2025 07:40 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

You can't use strings in swith case zig, interesting!

29.10.2025 14:48 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I am thinking about starting a systems reading group

29.10.2025 13:29 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Parsers are recursive because languages are recursive. Lexers are not recursive.

29.10.2025 13:06 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
When Are Lexer Modes Useful? String Interpolation, Regexes, Languages Embedded in HTML, etc.

i am still learning and understanding it, but this blog was really useful:
www.oilshell.org/blog/2017/12...

29.10.2025 10:50 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

and now you need to write lexer for this and in that string expression itself can be any expression so it is recursive expression, so it quite becomes task to solve this

29.10.2025 10:50 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

lexer modes are useful, but they didn't teach me in the textbook!

Imagine you are making a programming language in which you want to support the feature of template strings, like this:

> console.log(`${1 + 2 * 3} equals 7`)
7 equals 7

29.10.2025 10:50 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

decided to update my macOS because I wanted to use the latest version of Zig, and guess what, I totally hate liquid glass, my ocd is kicking from all sides

21.10.2025 19:26 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

it's simple, high cardinality means more unique combination possible, and need to think more about storing and figuring out where was the issue or how to store things more easily.

now it is making more sense, kids getting your fundamentals are very right.

20.10.2025 14:03 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Cardinality is nothing but size of a Set.

i need to now connect how cardinality in SRE is different or similar

20.10.2025 13:36 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

zig feels like the friendliness of C with good defaults, it is a joy to write.

15.10.2025 12:35 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Are You Sure You Want to Use MMAP in Your Database Management System?
YouTube video by CIDR DB Are You Sure You Want to Use MMAP in Your Database Management System?

Are You Sure You Want to Use MMAP in Your Database Management System?
www.youtube.com/watch?v=1BRG...

08.10.2025 04:23 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

On Windows, we only get the default stack size of 1 MB, while on macOS and Linux we get 8 MB.

when making cross platform programs, these things are the main pain points. UV solves this by running the main CLI in one thread and processing in a separate thread to avoid stack overflow!

07.10.2025 09:01 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Beautiful morning to write some good handwritten code. It's a privilege.

06.10.2025 03:24 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

found #rust container cheat sheet while i was reading performance book

05.10.2025 11:49 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

It just feels like people have stopped caring, and AI slope has amplified it even more!

not against using AI, if you know what you are doing and dealing with

04.10.2025 17:24 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image Post image

found about slint, an exciting project, and licensing is also done in a great way, would use this for future projects where i need to support native/embedded devices with very low memory footprint!

need to check how great tauri is on embedded devices, which i highly doubt

04.10.2025 13:13 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

While i am not thinking about becoming a researcher, but i really like the use case and things we can build using this field

09.09.2025 13:31 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
How To Become A Mechanistic Interpretability Researcher โ€” AI Alignment Forum Note: If youโ€™ll forgive the shameless self-promotion, applications for my MATS streamย are open untilย Sept 12. I help people write a mech interp paperโ€ฆ

link: www.alignmentforum.org/posts/jP9KDy...

09.09.2025 13:31 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Post image

Great guide on Mechanistic Interpretability

09.09.2025 13:31 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Frequently Asked Questions about FHE I work on homomorphic encryption (HE or FHE for โ€œfullyโ€ homomorphic encryption) and I have written a lot about it on this blog (see the relevant tag). This article is a collection of short answers to ...

Homomorphic encryption is interesting!

www.jeremykun.com/frequently-a...

19.07.2025 10:50 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

Why didn't they teach me like this?

14.07.2025 04:50 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
#Zustand Store Usage: Always use selector functions (e.g., `useStore(state => state.value)`) for selective subscriptions to prevent unnecessary re-renders and boost performance. See example: [image]

#Zustand Store Usage: Always use selector functions (e.g., `useStore(state => state.value)`) for selective subscriptions to prevent unnecessary re-renders and boost performance. See example: [image]

#Zustand Store Usage: Always use selector functions for selective subscriptions to prevent unnecessary re-renders and boost performance.

08.07.2025 09:27 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
Copy Hunting Insights, updates, and technical deep dives on building a high-performance financial transactions database.

Another great blog:

tigerbeetle.com/blog/2023-07...

i think LLVM IR learning is going to be worth it for my GSOC project and even afterwards

10.06.2025 20:35 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

link:
kmj-007.github.io/notes/tech/L...

10.06.2025 20:14 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
how to test LLVM IR:

LLVM has good way to test it's generated IR, you can do that using check, if you come across some code like this in your lifetime:

```rust
define void @sub1(i32* %p, i32 %v) {
entry:
; CHECK: sub1:
; CHECK: subl
        %0 = tail call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %p, i32 %v)
        ret void
}

define void @inc4(i64* %p) {
entry:
; CHECK: inc4:
; CHECK: incq
        %0 = tail call i64 @llvm.atomic.load.add.i64.p0i64(i64* %p, i64 1)
        ret void
}
```

; is how you define a comments in llvm IR, so that line will be ignored by llvm, but there is FileCheck tool, which is basically pattern matching file verifier.

so this tool basically does pattern matching for us, and we can verify generated IR, if it's correct or not!

another example:

```rust
    ; CHECK:  %0 = load i32, i32* %ptr, align 4
    %0 = load i32, i32* %ptr, align 4
```
In this example, theย `"; CHECK:"`ย line instructs FileCheck to ensure that the following instruction (`%0 = load i32, i32* %ptr, align 4`) matches the patternย `"%0 = load i32, i32* %ptr, align 4"`.ย 

In summary: Theย `";check"`ย directive is a way to guide FileCheck in verifying the correctness of LLVM IR code.ย It's not a part of the IR itself, but a comment used for testing purposes.

how to test LLVM IR: LLVM has good way to test it's generated IR, you can do that using check, if you come across some code like this in your lifetime: ```rust define void @sub1(i32* %p, i32 %v) { entry: ; CHECK: sub1: ; CHECK: subl %0 = tail call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %p, i32 %v) ret void } define void @inc4(i64* %p) { entry: ; CHECK: inc4: ; CHECK: incq %0 = tail call i64 @llvm.atomic.load.add.i64.p0i64(i64* %p, i64 1) ret void } ``` ; is how you define a comments in llvm IR, so that line will be ignored by llvm, but there is FileCheck tool, which is basically pattern matching file verifier. so this tool basically does pattern matching for us, and we can verify generated IR, if it's correct or not! another example: ```rust ; CHECK: %0 = load i32, i32* %ptr, align 4 %0 = load i32, i32* %ptr, align 4 ``` In this example, theย `"; CHECK:"`ย line instructs FileCheck to ensure that the following instruction (`%0 = load i32, i32* %ptr, align 4`) matches the patternย `"%0 = load i32, i32* %ptr, align 4"`.ย  In summary: Theย `";check"`ย directive is a way to guide FileCheck in verifying the correctness of LLVM IR code.ย It's not a part of the IR itself, but a comment used for testing purposes.

How to test the generated #LLVM IR

I am learning LLVM for my GSOC project, and will share lots of other notes

10.06.2025 19:43 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 1
Preview
Overcoming India's technological cowardice How can we learn to invent tomorrow?

I've finally published a long-gestating piece about why India has largely failed at research & development, and inventing novel products downstream of R&D, over the past few decades, as well as what we can do about it.

www.infinitesunrise.com/p/overcoming...

28.05.2025 21:12 โ€” ๐Ÿ‘ 2    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

@kmj007 is following 19 prominent accounts