HNHacker News
TopNewBestAskShowJobs

zackoverflow

1,410 karma · joined September 16, 2021

submissionscomments
zackoverflow··on Ratty – A terminal emulator with inline 3D graphics
This is kinda possible already today with the Kitty graphics protocol, I made a demo here of rendering 3D graphics[1] with kitty. The actual important missing thing (and which ratty seems to also not include) is vsync.

If rendering is not aligned then it's possible for the terminal emulator to read the framebuffer while the application is writing to it, causing visual artifacts.

[1] https://x.com/zack_overflow/status/2035921425341763756?s=20

zackoverflow··on Template Interpreters
I recently came across this style of interpreter which V8 and HotSpot use. It works by actually writing the bytecode op handlers in assembly (or some other low-level language) and generating them to machine code, and having a dispatch table mapping bytecode_opcode -> machine code to execute it

I was pretty intrigued. How does it compare to techniques which require way less engineering cost like switch+loop, direct-threaded, and only using tail-calls (https://blog.reverberate.org/2021/04/21/musttail-efficient-i...)?

The main reason seemed to be that both V8 and HotSpot have an optimizing JIT compiler, and having low-level control over the machine code of the interpreter means it can be designed to efficiently hop in and out of JIT'ed code (aka on-stack replacement). For example, V8's template interpreter intentionally shares the same ABI as it's JIT'ed code, meaning hopping into JIT'ed code is a single jmp instruction.

Anyway, I go into more implementation details and I also built a template interpreter based on HotSpot's design and benchmarked it against other techniques.

zackoverflow··on So you want custom allocator support in your C library
> Note that the context pointer came after the “standard” arguments. All things being equal, “extra” arguments should go after standard ones. But don’t sweat it! In the most common calling conventions this allows stub implementations to be merely an unconditional jump.

I didn't know this. Does this optimization have a name? Where can I read more about it?

zackoverflow··on Translations of Russ Cox's Thompson NFA C Program to Rust
Does anyone have any insight on why the PikeVM implementation is slower (it's based on the VM approach described here https://swtch.com/~rsc/regexp/regexp2.html)

I feel like compiling regex to bytecode and executing it should be faster than dealing with big graph like structures with NFAs/DFAs

Also, V8's regex engines are very fast because they get JIT compiled to machine code, so wouldn't bytecode just be one step higher in abstraction, and have worse but similar performance?

zackoverflow··on Translations of Russ Cox's Thompson NFA C Program to Rust
Most of the time you don't need to do this, usually its the solution for when creating a graph structure with cyclic references.

But when you do, and your data is mutable, generational indices are a legit and very useful strategy that is used in C/C++ too.

See this: https://floooh.github.io/2018/06/17/handles-vs-pointers.html

zackoverflow··on I wrote a Flappy Bird game in TypeScript's type system
Hey HN, I got inspired by a recent hack someone did of creating flappy bird in MacOS Finder, so I tried to do the same with type-level Typescript.

If you don't know, Typescript's type annotations are Turing complete, allowing you to compute anything with some clever type trickery.

In order to render graphics from Typescript's types, I ended up creating a compiler that compiles Typescript's types into bytecode, and a custom VM that can execute that bytecode.

Each frame, the VM takes draw commands from type-level Typescript, and renders it using the configured graphics backend. It can run in the browser by compiling the VM to Wasm and using the web's Canvas API.

zackoverflow··on Candle: Torch Replacement in Rust
I don't do anything related to data science, but I feel like doing it in Rust would be nice.

You get operator overloading, so you can have ergonomic matrix operations that are typed also. Processing data on the CPU is fast, and crates like https://github.com/EmbarkStudios/rust-gpu make it very ergonomic to leverage the GPU.

I like this library for creating typed coordinate spaces for graphics programming (https://github.com/servo/euclid), I imagine something similar could be done to create refined types for matrices so you don't do matrix multiplication matrices of invalid sizes

zackoverflow··on “Clean” code, horrible performance
> These "clean code" principles should not, and generally are not, ever used at performance critical code, in particular computer graphics.

I agree that this is mostly true, but maybe not for beginners in the field

When I was reading "Raytracing in One Weekend" (known as _the_ introductory literature on the topic), I was very surprised to see that the author designed the code so objects extend a `Hittable` class and the critical ray-intersection function `hit` is dynamically dispatched through the `virtual` keyword and thus suffers a huge performance penalty

This is the hottest code path in the program, and a ray-tracer is certainly performance critical, but the author is instructing students/readers to use this "clean code" principle and it drastically slows down the program.

So I agree most computer graphics programmers aren't writing "clean code", but I think a lot of new programmers are being taught them because of introductory literature

zackoverflow··on Fusion energy breakthrough by Livermore Lab
Can you elaborate more about the guarantees about no waste?
zackoverflow··on Using CRDTs for multiplayer text editing
Can you explain why they're more complex? I've always heard the narrative that OT is harder to get right because of edge case
zackoverflow··on I drink before I interview
Interesting that the wiki says that the performance enhancing effect comes from a lower heart rate, which is something you can influence with practice.

You can lower your resting heart rate naturally through exercise over time, and meditation and breathing techniques with practice give you control of your heart rate in the moment.

zackoverflow··on I drink before I interview
The active ingredient acetaminophen is anti-inflammatory which is where the reduced anxiety effects come from, perhaps you're not suffering from inflammation enough for it to take effect
zackoverflow··on Show HN: FFmpeg Command Visualizer and Editor
I haven't played much with live IO with ffmpeg. Tell me more about the difficulties of this usecase, I'd love to make it a better experience
zackoverflow··on Show HN: FFmpeg Command Visualizer and Editor
I haven't played around much with ffmpeg-python, I used to use fluent-ffmpeg for a bit. They're an improvement over writing raw command strings, but they lack static analysis features to verify the correctness of your command at compile time. There's only so much you can do with the constraints of general programming languages.

I'm going to add the ability to export graphs as ffmpeg-python/fluent-ffmpeg code, and to import a graph from ffmpeg-python/fluent-ffmpeg code as well.

zackoverflow··on Show HN: FFmpeg Command Visualizer and Editor
Honestly the pricing was selected kind of on a whim, I actually didn't think anyone would use the project. Will probably update the pricing.

I'm not sure how much information could be extracted from the binary, will need to do some more research. Maybe we could read the strings in the static part of the binary and extract some information.

`ffmpeg -i` prints out the configuration FFmpeg was built with, this mostly will let us know which encoder/decoders/container formats you can use. Will add a feature to parse and interpret that output.

I added an ffmpeg command string parser that converts the command stirng into graph nodes, but I temporarily disabled it to fix an infinite loop bug in my parsing code.

zackoverflow··on Show HN: FFmpeg Command Visualizer and Editor
Hey OP here, I spend a significant amount of time generating complex FFmpeg filtergraphs for my project. They can get really long and cumbersome, so I made this tool that lets you visualize and edit them, and generates the FFmpeg command string for you.

It sort of became an IDE/LSP for FFmpeg filters. My biggest problems were having to constantly to flip to FFmpeg documentation and errors in my filters. So I added autocomplete and embedded the FFmpeg docs. It also verifies the correctness of filters/arguments, and does an analysis on the graph to verify connections/etc.

zackoverflow··on Wisp: Whitespace to Lisp
I used to feel the same way, but after learning Haskell I think whitespace is particularly suited for functional programming languages.
zackoverflow··on Visualizing Delaunay Triangulation
Really entertaining read, had a few laughs throughout! but for some reason the text doesn't fracture properly on Brave/Chrome.

Here's a video demonstrating the problem: https://anno.so/71yMRyQfDXnm0QoHNpT6d/1

zackoverflow··on Show HN: Anno – Effortlessly annotate and comment on videos/audio
For Anno we are using HTML video elements / YouTube embeds which have the same frame inaccuracy from currentTime. For our editor we have a WebGL-based solution that seems to get better frame granularity but still has some floating point rounding errors converting frames <-> seconds

There's also requestVideoFrameCallback() and seekToNextFrame() in the Web APIs but they are still experimental/not supported by all browser. The WebCodecs API is also experimental/not supported to all browsers but would allow you to decode and grab the individual frames from a video and draw them to a canvas

zackoverflow··on Show HN: Anno – Effortlessly annotate and comment on videos/audio
Thanks! It's less about those that consume and more about the creation process, giving feedback/thoughts while working on a video or a song.

Also we use it internally to share looms with our eng team, where we leverage timestamped comments and annotations to enhance the sharing and discussion of ideas

zackoverflow··on Show HN: Anno – Effortlessly annotate and comment on videos/audio
https://anno.so/ZajoaZ8zJbdpATREt9qGW
zackoverflow··on Show HN: Anno – Effortlessly annotate and comment on videos/audio
Hey HN, I'm one of the founders of Modfy.video - we just shipped Anno.so which lets you add timestamped comments and annotations (drawings, scribbles, notes) to videos & other media files.

We currently use it to add comments and markup to Loom videos about dev problems we share among our engineering team, it’s been a great help.

Anno.so supports uploaded videos, audio, YouTube videos, Loom videos, SoundCloud audio. It’s free to use with no sign-up required.

This is a project we spun out from a video editor we’re currently working on https://modfy.video if interested.

zackoverflow··on First 6 years of a life of Clojure project – Jarppe Länsiö
Entertaining talk not so much about Clojure, but tackling the scaling problems of software engineering in general. Great movie references throughout, had a lot of fun watching it
zackoverflow··on Show HN: Aussie++, an Australian programming language written in Rust
Sorry you feel that way, it is meant to be a low-brow joke language, but definitely not supposed to feel mean-spirited. The language spec was originally designed by mostly Australians.

https://github.com/louis1001/c---/issues/5

So that gave me the sense that Australians were ok with this type of humor, though I did make some minor adjustments.

I'm open to suggestions for revising the syntax to make it feel like it's less mean-spirited.

zackoverflow··on Show HN: Go playground powered by WASM that runs in the browser
thanks! when I came up with it I couldn't believe I hadn't thought of it earlier lmao
zackoverflow··on Show HN: Go playground powered by WASM that runs in the browser
Couldn't find a list but I tested it on brave, chrome, firefox, safari and it was safari that was having troubles
zackoverflow··on Show HN: Go playground powered by WASM that runs in the browser
I poked around earlier and found this file: https://github.com/oxfeeefeee/goscript/blob/master/vm/src/gc...

Perhaps someone can shed more light on how exactly it works

zackoverflow··on Show HN: Go playground powered by WASM that runs in the browser
Thanks, this is a problem with some browsers not supporting BigInt <-> Wasm i64 conversion, I just made some changes that should fix it
zackoverflow··on Show HN: Go playground powered by WASM that runs in the browser
This is a little experiment demonstrating the capabilities of the goscript project (https://github.com/oxfeeefeee/goscript) by compiling it to wasm.

Here's the source code (https://github.com/zackradisic/go-playground-wasm) if you would like to look at it and do something similar with your own projects.

I'm really excited for the future of goscript, Go is a great candidate for a scripting language thanks to its minimalistic design choices.

zackoverflow··on Show HN: Tiny-vdom – Smallest possible virtual DOM implementation
How should one approach learning about building a virtual DOM? Are there any particular resources or pieces of literature you recommend taking a look at?
Page 1 of 2Next →