AkshitGarg | 1 year ago | on: How much memory do you need in 2024 to run 1M concurrent tasks?
AkshitGarg's comments
AkshitGarg | 2 years ago | on: Why are Apple Silicon VMs so different?
AkshitGarg | 2 years ago | on: Structured logging with slog
slog.Info("hello, world", slog.String("user", os.Getenv("USER")))
[1]: https://pkg.go.dev/log/slog#hdr-Attrs_and_ValuesAkshitGarg | 2 years ago | on: Barco: Linux Containers from Scratch in C
AkshitGarg | 4 years ago | on: From TypeScript to ReScript
AkshitGarg | 4 years ago | on: Ask HN: How does Safari on iOS manage memory for multiple tabs?
AkshitGarg | 4 years ago | on: Android in Docker without QEMU/emulator
AkshitGarg | 4 years ago | on: Redesigned Notepad for Windows 11
Screenshot: https://i.imgur.com/vCJF5UW.png
AkshitGarg | 4 years ago | on: CPython's main branch running in the browser with WebAssembly
AkshitGarg | 4 years ago | on: Tree Sitter and the Complications of Parsing Languages
I do have a minimal amount of highlighting though.
AkshitGarg | 4 years ago | on: Tree Sitter and the Complications of Parsing Languages
It was hard for the first few hours, but then I eventually got used to it, and now I can't use anything else.
I know this is not quite as extreme as working without syntax highlighting :)
AkshitGarg | 4 years ago | on: Tree Sitter and the Complications of Parsing Languages
LSPs provide an "outline" which can be very useful to navigate through code. I find "jump to symbol" function in my text editor to be faster than scanning all of the code to find the line.
Also most themes dim the comments, but IMO if something in the code needed an explanation, it should be brighter, not dimmer.
[0]: https://github.com/tonsky/sublime-scheme-alabaster
[1]: https://github.com/gargakshit/vscode-theme-alabaster-dark
AkshitGarg | 4 years ago | on: Ask HN: What browser extensions are a must-have in 2021?
AkshitGarg | 4 years ago | on: Show HN: Run Python, Ruby, Node.js, C++, Lua in the Browser via x86 to WASM JIT
It is already possible! See https://github.com/pyodide/pyodide
AkshitGarg | 4 years ago | on: Show HN: Running a simple local HTTP server in a web page
[0]: vscode.dev
AkshitGarg | 4 years ago | on: GitHub Advisory Database now powers NPM audit
AkshitGarg | 4 years ago | on: Mosquitto: An open-source MQTT broker
AkshitGarg | 4 years ago | on: Beam/Erlang/Elixir Concept Explanations
AkshitGarg | 4 years ago | on: Windows Subsystem for Linux GUI
https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk
AkshitGarg | 4 years ago | on: OpenMoji: Open-source emojis
[1]: https://github.com/googlefonts/noto-emoji/blob/main/LICENSE
For example, for node, the author puts a million promises into the runtime event loop and uses `Promise.all` to wait for them all.
This is very different from, say, the Go version where the author creates a million goroutines and puts `waitgroup.Done` as a defer call.
While this might be the idiomatic way of concurrency in the respective languages, it does not account for how goroutines are fundamentally different from promises, and how the runtime does things differently. For JS, there's a single event loop. Counting the JS execution threads, the event loop thread and whatever else the runtime uses for async I/O, the execution model is fundamentally different from Go. Go (if not using `GOMAXPROCS`) spawns an OS thread for every physical thread that your machine has, and then uses a userspace scheduler to distribute goroutines to those threads. It may spawn more OS threads to account for OS threads sleeping on syscalls. Although I don't think the runtime will spawn extra threads in this case.
It also depends on what the "concurrent tasks" (I know, concurrency != parallelism) are. Tasks such as reading a file or doing a network call are better done with something like promises, but CPU-bound tasks are better done with goroutines or Node worker_threads. It would be interesting to see how the memory usage changes when doing async I/O vs CPU-bound tasks concurrently in different languages.