HNHacker News
TopNewBestAskShowJobs

nsm

1,439 karma · joined August 3, 2009

I work at Skydio. Opinions here are my own.

Website: https://nikhilism.com

submissionscomments
nsm··on Threads and Goroutines
I am aware of epoll_wait and friends (select/poll) accepting timeouts, and how that plugs into a general event loop like in libuv.

However if memory serves, these calls are reasonably expensive (on the order of microseconds, and _worse_ if readiness requires putting the current thread to sleep and then waking it up again). However https://www.ardanlabs.com/blog/2018/08/scheduling-in-go-part... says goroutines are closer to 200ns.

However the same source above does a decent job of explaining how epoll is being called "out of band". I am guessing when they talk about context switching costs, they are doing some sort of amortization of these system call costs. Since the actual OS threads try to remain CPU-affine (thread-per-core, LMAX disruptor etc. etc.), a lot of the OS scheduling costs can be skipped.

Thank you for the pointer to the source code. It gives me a starting point.

nsm··on Threads and Goroutines
The crucial operation here is epoll_wait, not epoll_create.

Are you saying that the system call is performed on another kernel thread while goroutine continue running on the GOMAXPROCS threads?

nsm··on Threads and Goroutines
I feel like this glossed over how when entering something like epoll, Go can optimize switching to another goroutine. Wouldn't the epoll block until the calling kernel thread had a file descriptor ready?
nsm··on Ask HN: Could you share your personal blog here?
https://nikhilism.com - occasional technical writings, sometimes digging deep into systems internals.
nsm··on Racket: Lisp for the modern day
IMO a couple of cool aspects of Racket that aren't called out in beginner guides, but I think are really useful in real programs:

1. The use of custodians on a per-(green-)thread basis that brings "oh yes, if the thread crashes or is shutdown, racket guarantees that all open files/sockets/resources will be shut down". For example you can use this to ensure that a timed out client doesn't cause unnecessary resource usage. https://docs.racket-lang.org/more/index.html#%28part._.Termi...

2. Events and composable concurrency from Concurrent ML - Unlike Go's channels, concurrent ML events are composable up the stack, and have some nice things built in like "NACK events" (allowing cancellation down the stack). Unfortunately there aren't great primers about using this that I know of apart from the Kill Safe Synchronization Abstractions paper. https://users.cs.utah.edu/plt/kill-safe/

3. Sandboxing - https://docs.racket-lang.org/reference/Sandboxed_Evaluation....

Some of these were added to make it easier for the IDE to manage errant programs that could be written by beginners, but it is also a very "applicable to production" set of tools. Racket internalizes Extra-linguistic mechanisms https://felleisen.org/matthias/manifesto/sec_intern.html

Also the fact that various DSLs can inter-op with each other directly, so that you can use something like a binary parser description, as if it was just another Racket library. For example this description of the format https://github.com/Bogdanp/racket-binfmt/blob/master/binfmt-..., is directly included in another file as a regular library https://github.com/Bogdanp/racket-binfmt/blob/master/binfmt-...

I agree that startup time is not a winning aspect of Racket. My naive understanding is because Racket is not a direct bytecode interpreter like CPython, but actually has to run a compile step to native code, and doing that for programs + their required libraries necessarily takes at least a couple of hundred milliseconds even before anything can start running, while CPython can pretty much start executing from the get go.

nsm··on New record anomaly for North Atlantic sea surface temperatures
> I don't have an AC

This sort of degrowth stuff doesn't work. In the tropics, day time temperatures will be above what humans can _survive_ in, and air conditioning is the only way to keep billions of people alive in places like India.

We already have the technical solutions to have enough energy for everybody to have an AC while emitting minimal carbon (and perhaps generating enough electricity to actively take out carbon) - solar, wind, geothermal and nuclear.

The actual fixes western countries need to do is to actually make it easier to _build_ new things instead of trying to become poorer. Interconnect transmission lines (so we can carry power long distances), permitting for nuclear and geothermal (for various reasons requiring a much higher burden of proof and safety regulations than fossil fuel extraction and burning that kills way more people), _BUILDING MORE FUCKING HOUSING_ so people don't need to drive farther and farther, and they can walk and bike to get groceries and meet friends. These are all things that require policy decisions from people who are trapped in a bad incentive structure of both NIMBY local voters, and an attention oriented media that rewards both polarization and extreme cover-your-ass behavior that makes building expensive. Trying to put (and take) personal responsibility and giving up random things that don't move the needle isn't the way to do it.

nsm··on Any Suggestions for a Password Manager?
Note that if your company uses 1password you get a _free_ family account for personal use!

https://support.1password.com/link-family/

nsm··on Witch – macOS window switcher replacement
This app called Finda https://keminglabs.com/finda/setup/#chrome-and-firefox-tabs has to use an extension to support this functionality. That seems like a fairly reliable way to get the list of tabs, with the downside that writing a browser extension is a lot less trivial than having a quick command line thing.
nsm··on Ask HN: What are your favourite bullshit bingo buzzwords?
"Modern"

"Rust"

nsm··on Is it common for Java devs to wait 30s+ for a recompile after making any change?
I don't have a lot of Java experience, but this definitely doesn't line up. For any compiled language, modern compilers for C++/Java are generally fast enough for most codebases, BUT companies need to invest in their actual build processes to keep things optimal.

If the dependency tree is such that making a 1 line change still causes a 500 file recompilation, yes, you could be seeing a multiple second wait.

nsm··on Spritely Goblins v0.11.0, time travel distributed debugger and more
Is there some public rationale about prioritizing Guile over Racket?
nsm··on Ask HN: Most interesting tech you built for just yourself?
I have a hacky combination of Playwright browser automation plus Tesseract OCR that splits a Verizon group plan among members by posting individual totals to Splitwise. Simple at first glance, but there are always small changes due to people traveling overseas or changing devices.
nsm··on Why don’t more people live close to friends?
Do you mean conscientiousness? Low contentiousness is nearly the opposite of what you are going for
nsm··on Why Janet?
That is fair, I agree they don't bid for the same projects.

In terms of listed points.

1. Simplicity... perhaps? I guess Racket has a larger surface area, but just like all Lisps/Schemes it is built on a simple core. 2. Distribution. Janet probably wins here. Racket can produce static binaries, but they may not be as tiny. Relatedly, there is a Racket subset, Zuo, that ticks this box. 3. Parsing text - Racket's whole shtick is this, given it is a language for writing languages :) 4. Subprocess DSL. `sh` looks like a nice library. I can see the value for using this for quick scripts since you can shell out to bash whenever you want. 5. Embeddable. Janet is better here similar to Lua. Also see Zuo. 6. Mutable and immutable collections. Racket has these. 7. Macros. Racket has these. 8. Compile time to run time. I'm not sure about this, being a Racket newbie. 9 and 10 - very subjective :)

Cheers! Thanks for the great article!

https://docs.racket-lang.org/zuo/index.html

In some sense it is a little sad that the Lisp and Scheme like languages diverge so much within themselves, as it makes an already unpopular set of languages even harder to standardize on and evangelize.

nsm··on Why Janet?
Could someone compare Janet with Racket? The latter is a much more mature project with a powerful and well designed standard library, so I'm not sure why one would pick Janet.

I see the appeal to embed in another app as a scripting language like Lua, but for writing standalone programs?

nsm··on Janet for Mortals
Sorry, I meant to respond to this but went to the parent https://news.ycombinator.com/item?id=35392704
nsm··on Janet for Mortals
Doesn't raco make followed by raco exe produce fully standalone (except libc) executables? I believe some platforms need an additional raco distribute step.
nsm··on Java 20 / JDK 20: General Availability
Thanks! I keep forgetting to reach for this.
nsm··on Java 20 / JDK 20: General Availability
What are some good primers to understand the prominent new Java features? Not just in 20, but since, say, 8. Asking as someone who would like to be cursorily familiar with Java, but does not use it day to day. I'm very familiar with things like auto type inference, pattern matching, multi-line strings and structured concurrency from other languages, so I'm not looking for an introduction to Java. I'm looking for something like "Modern Java for the experienced Rust/Python/C++ programmer". Thanks!
nsm··on Ask HN: What has your personal website/blog done for you?
It hasn't directly influenced my career, but hiring managers and interviewers certainly mention reading it and I'm sure it indirectly influences hiring decisions.

In addition the specific post about my ankle fracture is somehow one of the most popular when searching for "ankle fracture blog", and I've had at least one person reach out to me who also had a fracture and were comforted by my account.

nsm··on Plastic-based fuels may present an “unreasonable risk” to human health
Modern waterproof textiles are used by lots and lots of people that keep your basic infrastructure running, that allows you to stay in your warm, insulated, dry house. So they can stay reasonably comfortable while doing jobs like keeping the power running in a snowstorm, or keeping the roads clear for emergency vehicles.
nsm··on Launch HN: Moonrepo (YC W23) – Open-source build system
You actually don't want a real programming language because their unbounded loops and standard libraries are sources of non-determinism that can introduce incorrectness in your build. Bazel's correctness is highly contingent on the same set of inputs producing the same outputs, and granularly tracking dependencies, running commands in sandboxes AND having a restricted build language is a key part of it.

That said, Starlark is way closer to a real language (Python) than YAML.

nsm··on Launch HN: Moonrepo (YC W23) – Open-source build system
There is also a Rust implementation of Starlark as a starting point https://github.com/facebookexperimental/starlark-rust

To add to everyone else, please don't use YAML. Starlark is great _precisely_ because it is a readable, well known (nearly Python) language that is limited at the same time (no unbounded for loops, no way to do non-deterministic things like get the current time or `random()`).

nsm··on “The current climate in AI has so many parallels to 2021 Web3”
I am really looking forward to AI that can help us solve hard biology and engineering issues (say nuclear reactor design, materials science) practically. Or an AI that will help solve coordination problems by telling us exactly where to compromise and how to negotiate so that everyone will agree to say relax zoning regulations. I know there are things like AlphaFold and probably lots of proprietary things in niche industries I'll never hear about because no mainstream media is going to cover that. Are there such examples?

I find the likes of ChatGPT wonderful, but in the end image and copy generation seems like a very first world/"content creator" use case that won't help us solve critical problems.

nsm··on Devpod: Remote development environment at Uber
People seem to conflate a monorepo with having everything else the same as well, just because that's how Google and other BigCos do it. You don't have to.

At some level a monorepo is just a way to stick all your code in one giant directory and manage it all under one VCS repository.

You could still do separate build tools per project, separate vendoring if you really wanted and so on.

However you may find that being able to simply import other first party code by path instead of doing some cross repo dependency process is a massive win.

Edit: apologies, this was meant to be a reply to the top level comment.

nsm··on DoorDash lays off 1250 employees
I agree they are not entirely fair. However lottery/random systems have a lot of burden of work that ends up wasted, leading employers to shy away from doing it. If you have do X amount of paperwork per candidate and there is only a 20% chance of getting through to the lottery, why do it?

In the absence of enough funding and employees at USCIS to be able to individually assess people, having some kind of cutoff criteria is better than a lottery. Don't let perfect be the enemy of the good.

nsm··on DoorDash lays off 1250 employees
While there may be a lot of countries where it may be harder in terms of qualifications, the US is probably singular among western democracies around the capriciousness and randomness of its processes. Particularly for skilled immigrants, and particularly those from India and China.

Which other country goes "skilled immigrants RAH RAH!" but also imposes a random lottery instead of going on the basis of some kind of points/job offer based system? In which other country can you have a "manager" in your job title and then get a fast track to PR (L1-A) regardless of whether you are a Technical Account Manager 2 years out of school vs a Director with 20 years of experience?

Which other country imposes arbitrary moving dates for when you can get permanent residency? My understanding is every western democracy has a well defined path to permanent residency from a work visa. In Canada it is 0-3 years, in the EU it is 2-5 years (based on various factors). But once you tick those boxes you know how much time it will take. In the US, it really depends on USCIS's budget, the phase of the moon, which country you are born in, and how many green cards they decide to "waste" in any given year.

nsm··on The Restaurant Industry’s Worst Idea: QR Code Menus
At least the Pixel camera app does native QR code scanning.
nsm··on Ask HN: Is it still possible to live in a terminal?
Are your concerns about the lack of open APIs or the lack of command line apps per-se?

Personally I'm all in favor of having more open APIs and third party clients, but would never want to intentionally constrain myself to a TTY that is half a century old.

nsm··on Cloud desktops aren't as good as you'd think
Is there a way in JB Gateway to re-use an existing project?

I am in the office 50% of the time, working on my desktop with CLion. The other 50% I'm remote. The one time I tried Gateway, it asked me to create a new project, which meant building another index of a giant codebase, and not having any of my per-project settings. The time and disk space of another index turned me off right away. I couldn't find a way to just re-use the existing project. So for now I just suffer through using NoMachine to remote in, and then operate CLion.

← PreviousPage 3 of 10Next →