News for hackers. Stuff that matters.

AkshitGarg

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.

Re:Why are Apple Silicon VMs so different? on Friday December 29, 2023 @08:18AM (#38804553)
IIRC that runs a x86_64 userland (using Rosetta) on a arm64 kernel.
Re:Structured Logging with Slog on Wednesday August 23, 2023 @02:11AM (#37232383)
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
Re:Barco: Linux Containers from Scratch in C on Monday August 07, 2023 @02:37AM (#37030989)
Re:From TypeScript to ReScript on Wednesday January 12, 2022 @12:11PM (#29909645)
ReScript doesn't uses esbuild. It has its own compiler: https://github.com/rescript-lang/rescript-compiler
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).
Re:Android in Docker without QEMU/emulator on Tuesday January 04, 2022 @09:04AM (#29794825)
According to its README, it does run (and is tested) on WSL 2 (Ubuntu) (amd64).
Re:Redesigned Notepad for Windows 11 on Wednesday December 08, 2021 @06:52AM (#29483678)
It has been there since atleast windows 95.

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

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.
Re:Tree Sitter and the Complications of Parsing Languages on Wednesday November 24, 2021 @05:34AM (#29328658)
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

Re:Tree Sitter and the Complications of Parsing Languages on Wednesday November 24, 2021 @05:26AM (#29328610)
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 :)

Re:Tree Sitter and the Complications of Parsing Languages on Wednesday November 24, 2021 @05:21AM (#29328577)
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

Re:Ask HN: What browser extensions are a must-have in 2021? on Tuesday November 23, 2021 @04:51AM (#29316145)
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...
> given enough work, run Python directly in Wasm

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

Re:Show HN: Running a simple local HTTP server in a web page on Sunday October 31, 2021 @11:39AM (#29057742)
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

Re:GitHub Advisory Database now powers NPM audit on Thursday October 07, 2021 @02:01PM (#28789959)
That might be unrelated to the audit database change as NPM is currently having a service outage.

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

Re:Mosquitto: An open-source MQTT broker on Wednesday September 29, 2021 @12:39PM (#28696176)
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

Re:Beam/Erlang/Elixir Concept Explanations on Monday September 13, 2021 @12:45AM (#28507940)
Erlang includes erlang bindings for wxWidgets as used by observer and debugger. It is certainly possible to use them for making desktop GUIs.
Re:Windows Subsystem for Linux GUI on Saturday September 11, 2021 @12:57AM (#28489533)
You can use WSL to mount ext4 and other filesystems supported in linux.

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

Re:OpenMoji: Open-source emojis on Friday September 03, 2021 @02:28PM (#28407649)
Noto uses Apache-2.0 [1] which should be fine for most stuff.

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

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.
Re:Competitive programming is useless on Monday August 23, 2021 @12:20PM (#28278221)
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.
Not to mention a lot of critical components of modern infrastructure like docker, podman and kubernetes are built using go
Re:WinFsp – Windows File System Proxy on Sunday August 22, 2021 @10:43AM (#28265859)
It also has a FUSE compat layer which maybe useful when porting existing *nix software
> 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

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

Older »