HNHacker News
TopNewBestAskShowJobs

AkshitGarg

102 karma · joined July 24, 2020

submissionscomments
AkshitGarg··on How much memory do you need in 2024 to run 1M concurrent tasks?
I feel this benchmark compares apples to oranges in some cases.

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.

AkshitGarg··on Why are Apple Silicon VMs so different?
IIRC that runs a x86_64 userland (using Rosetta) on a arm64 kernel.
AkshitGarg··on Structured logging with slog
You use attrs [1] instead. I personally find this much more readable, and prefer this.

  slog.Info("hello, world", slog.String("user", os.Getenv("USER")))
[1]: https://pkg.go.dev/log/slog#hdr-Attrs_and_Values
AkshitGarg··on Barco: Linux Containers from Scratch in C
Windows also supports containers: https://learn.microsoft.com/en-us/virtualization/windowscont...
AkshitGarg··on From TypeScript to ReScript
ReScript doesn't uses esbuild. It has its own compiler: https://github.com/rescript-lang/rescript-compiler
AkshitGarg··on Ask HN: How does Safari on iOS manage memory for multiple tabs?
Chrome and Firefox on iOS are just skinned safari with their own sync and features. Apple does not allow third party browser engines and you absolutely have to use the one built into the system (webkit).
AkshitGarg··on Android in Docker without QEMU/emulator
According to its README, it does run (and is tested) on WSL 2 (Ubuntu) (amd64).
AkshitGarg··on Redesigned Notepad for Windows 11
It has been there since atleast windows 95.

Screenshot: https://i.imgur.com/vCJF5UW.png

AkshitGarg··on CPython's main branch running in the browser with WebAssembly
Yep you need to specify the maximum memory amount up-front. Its defined as "webassembly memory pages". Each page is 64kb. You need to specify an initial and a maximum amount. The webassembly module can call memory.grow() to grow it by a page until it reaches the maximum. Though you can't "un-grow" or decrease the amount of allocated memory.
AkshitGarg··on Tree Sitter and the Complications of Parsing Languages
Not the OP, but my editor colors the parenthesis red in case of an imbalance [0].

I do have a minimal amount of highlighting though.

[0]: https://imgur.com/haVWset

AkshitGarg··on Tree Sitter and the Complications of Parsing Languages
I grew up with fully fledged syntax highlighting, but I still prefer to use really minimal themes as I find them to reduce cognitive overhead and eye strain.

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··on Tree Sitter and the Complications of Parsing Languages
While I don't fully disable syntax highlighting, I use a minimal theme [0,1] that only has highlighting for comments, strings and globals. It reduces eye strain for me, and I never find myself relying on highlighting to navigate through code.

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··on Ask HN: What browser extensions are a must-have in 2021?
Not only firefox, but edge, chrome and safari too. EFF is deprecating HTTPS everywhere. See https://www.eff.org/deeplinks/2021/09/https-actually-everywh...
AkshitGarg··on Show HN: Run Python, Ruby, Node.js, C++, Lua in the Browser via x86 to WASM JIT
> given enough work, run Python directly in Wasm

It is already possible! See https://github.com/pyodide/pyodide

AkshitGarg··on Show HN: Running a simple local HTTP server in a web page
You can use vscode's web editor [0] which allows you to open local folders and even run full LSPs for JavaScript, TypeScript and Python

[0]: vscode.dev

AkshitGarg··on GitHub Advisory Database now powers NPM audit
That might be unrelated to the audit database change as NPM is currently having a service outage.

https://status.npmjs.org/incidents/7pqfqvkwvb58

AkshitGarg··on Mosquitto: An open-source MQTT broker
The NATS protocol [0] looks pretty simple, but is text based unlike MQTT which uses a size optimized binary protocol.

[0]: https://docs.nats.io/nats-protocol/nats-protocol

AkshitGarg··on Beam/Erlang/Elixir Concept Explanations
Erlang includes erlang bindings for wxWidgets as used by observer and debugger. It is certainly possible to use them for making desktop GUIs.
AkshitGarg··on Windows Subsystem for Linux GUI
You can use WSL to mount ext4 and other filesystems supported in linux.

https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

AkshitGarg··on OpenMoji: Open-source emojis
Noto uses Apache-2.0 [1] which should be fine for most stuff.

[1]: https://github.com/googlefonts/noto-emoji/blob/main/LICENSE

AkshitGarg··on Twitter.com's HTML, which is produced by React Native for Web, explained
Flutter web has issues with accessibility. They do support screen readers once you enable accessibility by pressing a button, but its rather bad right now. Also scrolling is emulated and doesn't feel great.
AkshitGarg··on Competitive programming is useless
So much of this. In my CS class, I could hardly find anyone who actually had some curiosity to learn. Everyone does their homework by sharing answers on the class chat. And in team projects, either there is one person who does all the work, or they end up copying from google and stackoverflow.
AkshitGarg··on Ash HN: Go or Rust for JavaScript developer in the next 20 years?
Not to mention a lot of critical components of modern infrastructure like docker, podman and kubernetes are built using go
AkshitGarg··on WinFsp – Windows File System Proxy
It also has a FUSE compat layer which maybe useful when porting existing *nix software
AkshitGarg··on Facebook hacker beat my 2FA, bricked my Oculus, and hit the company credit card
> impersonate you for the next 30 seconds.

AFAIK some websites allow you to use the previous TOTP code for convenience for some more seconds. That makes the total time to impersonate you to be 30 (or whatever was configured while issuing the TOTP secret) plus the grace period websites allow.

Edit: formatting

AkshitGarg··on Facebook hacker beat my 2FA, bricked my Oculus, and hit the company credit card
It certainly recognizes the domain, but thats more of a convenience feature than a security feature. Nothing is stopping you from putting your example.com code into legit-example.com manually. Sure the extension won't do it automatically, but if the user is convinced to put the password into the fake website, user could also put in the TOTP code
AkshitGarg··on Show HN: Simple Image encrypt/decrypt using Python
Or maybe argon2 as it is "memory hard"
AkshitGarg··on Launch HN: SigmaOS (YC S21) – A MacOS web browser designed for faster work
Tab groups also exist in chrome, brave and edge (was behind a flag last time I checked), and presumably other chromium-based browsers too
AkshitGarg··on MeiliSearch: A Minimalist Full-Text Search Engine
Not sure, but I think they are taking about the recent licensing changes of the elasticsearch server [0] and restricting elasticsearch clients to only be compatible with elasticsearch, not any forks [1]

[0]: https://www.elastic.co/pricing/faq/licensing [1]: https://news.ycombinator.com/item?id=28110610

AkshitGarg··on Ask HN: Is Vagrant Dead?
I just checked their GitHub [0], and they seem to have a release on 27th July, 2021. Also it looks like they are re-writing vagrant 3.0 using go [1]

[0]: https://github.com/hashicorp/vagrant

[1]: https://www.hashicorp.com/blog/toward-vagrant-3-0

Page 1 of 2Next →