Better HN
topnewbestaskshowjobs
Log inSign up

jdxcode

1,380 karma · joined Mar 19, 2020 (6y ago) · 457 submissions

https://github.com/jdx
Submissions

comment 2y ago · link · parent

I documented how to do it with mise-en-place: https://mise.jdx.dev/tips-and-tricks.html#shebang

comment 2y ago · link · parent

> average developer

I don't know about you but "performance upgrades on ancient hardware" isn't exactly the sort of thing my manager would be terribly happy I was focusing my time on.

comment 2y ago · link · parent

I think there are 2 ways usage will be used, either as an under the hood format used by frameworks to make frameworks better, or directly by users to scaffold framework code

comment 2y ago · link · parent

My goal is that one day framework authors will adopt this (they might do it quickly since it’s a hell of a lot easier to dump a usage spec and generate completions than it is figuring out how to write completions for each shell).

At that point it would make sense for them to also make scaffolding generators, meaning the cli author only has to write one spec and don’t have to repeat the effort for their code so much.

comment 2y ago · link · parent

Yeah I investigated. I don’t think it works well that direction. It is appealing and you can see some elements of it in my current design, though that’s a particular part I’m still unsure of.

It gets way too complicated real quick and a lot of things you _dont_ want to expose in documentation. It’s better to generate docs from a spec than the other way around, I’m pretty sure of this now.

comment 2y ago · link · parent

it's not complete, but I've been thinking about this problem for years and have been thinking about how to solve it.

I am working on it here: https://github.com/jdx/usage

It's mostly just a README right now, and I'm still iterating on it, talking to friends, but I think I'm getting close. It's definitely not yet written for the average developer to consume yet either. My hope is within the next month or two I might have a usable alpha release of it. I have a use-case for it now so I think it’s finally ready to happen.

If you have any thoughts on my design lmk.

comment 3y ago · link · parent

Thanks for posting @royjacobs. Sadly rtx has never really been a hit on HN. One day it’ll make a splash I’m sure!

comment 3y ago · link · parent

.venv, obviously. Just like node and node_modules. No need to make this configurable beyond VIRTUAL_ENV

comment 3y ago · link · parent

Ridiculous does not mean uncommon. Situations can be both common and ridiculous (absurd).

I'm American, but I have enough friends and family from other countries (my wife is an Iranian passport holder) to know what you're talking about and how difficult it can be.

comment 3y ago · link · parent

How on earth have you come to that conclusion? Bun is written in Zig—which is a low-level C replacement.

comment 3y ago · link · parent

I've never understood why HN has never included even a 80 character description. I think it would really help even if it was only shown on the comments tab.

comment 3y ago · link · parent

That doesn't help CI performance. I bet `bun install` is way faster than `pnpm install` on a cold or hot cache (though I haven't tested myself). I think it does similar things to pnpm under the hood to improve local development speed as well.

EDIT: just tested on the eslint codebase:

cold (nothing installed, no cache): bun: 1.53s, pnpm: 8.25s, npm: 25s

hot (already installed, noop): bun: 218ms, pnpm: 1300ms, npm: 1230ms

comment 3y ago · link · parent

I don't think you understand the point of bun. It's not to make npm/webpack/typescript faster at running JS code, it's to replace those tools entirely. So in essence, it's doing the same thing that esbuild is doing, just across all of the major tasks people currently do with node. What's different about bun vs esbuild is that it's one tool you can use for everything you do in JS projects.

I've swapped much of my usage of npm over to bun. I still work on projects where nobody else is using bun, but I can run `bun install` instead of `npm install` and `bun run` instead of `npm run` and these run probably 100x faster.

comment 3y ago · link · parent

I bet nearly 100% of web apps would benefit from increased performance in npm install, typescript and webpack compilation

comment 3y ago · link · parent

> I might not need to add anything to .*rc files if rtx is in my path

Generally speaking you'll probably want to use `rtx activate` in your shell rc. However you could use the shims instead if you just wanted to add a directory to PATH instead.

Of course you'd be getting rid of one of the major selling points of rtx by using shims, but it's so much faster than asdf the shims aren't as bad as they are in asdf.

comment 3y ago · link · parent

pyenv is really slow. It'll increase the time it takes to run `python` by a ton. For me it makes `python -V` take ~120ms but without pyenv it only takes ~13ms.

I wrote an alternative that has 0 overhead called rtx. https://github.com/jdxcode/rtx

comment 3y ago · link · parent

also check out rtx (my project), which does everything asdf does but 20x-200x faster and with better UX https://rtx.pub

comment 3y ago · link · parent

I just added `rtx install --all` which installs all plugins and all runtimes. It's in v1.3.0

comment 3y ago · link · parent

I knew you wouldn’t be the only one so I made sure that “rtx” was not a popular lisp library. :)

comment 3y ago · link · parent

> adding them to the shell as functions

This, like shims, would require “reshimming” anytime a new binary is added by pip/npm. I really want to avoid that as I see juniors (and sometimes experienced devs) get in a bad state fairly often forgetting (or not understanding) reshimming.

I’m also not sure how you deal with subprocesses calling binaries. If they’re only shell functions they only exist to the shell.

> save the extra exec

rtx is already over 100x faster than asdf so this wouldn’t be necessary really. I could load test and optimize for setups with a ton of plugins and stuff if needed. My reason for avoiding shims is entirely UX related, not performance. Though I do think asdf would not have its problems if it didn’t use shims. This really is just because asdf is in bash and rtx is in rust. (I think rtx is already a lot more LOC though, and not as clean).

But in regards to PATH, I think I can get rtx to not screw up anything else that would be modifying PATH (slightly different algo than what’s currently used right now). I can’t guarantee that nothing will screw up rtx, but I can prevent direnv in particular from doing it.

It may be a game of whack-a-mole testing with different tools that modify PATH to get them to not conflict. That’s fine, it’s such a better solution.

I also think if rtx is loaded after other hooks it shouldn’t get messed with. It’s only if it gets called since potentially those tools could remove rtx paths and there isn’t much I could do about that.

comment 3y ago · link · parent

I actually had this as the default behavior of `rtx install` but it felt a bit wild for it to just go out and download a bunch of stuff. I feel like it’s nice to have a bit more control over which runtimes are and are not managed by rtx.

That said, I was thinking about this yesterday and that it’s currently painful to have to type out each plugin one by one. I added this ticket for making `plugins install` default to installing all plugins in the local tool-versions: https://github.com/jdxcode/rtx/issues/50

What do you think? Is that discoverable and useful enough? I could go a step further and add a `--plugins` argument to install or something.

comment 3y ago · link · parent

I'm on an M1 MacBook Pro 16". The performance issues are well understood by the asdf team and the Github issue with most comments is on the topic: https://github.com/asdf-vm/asdf/issues/290

This was with a half dozen plugins and use_legacy_file disabled. Hardly an edge-case. Though I'll note in other tests it was around 200ms (which is the number I put in the README to be fair). @danfritz in this thread said his can take over 2 seconds!

Out of curiosity, what is the difference between `time node -v` and `time ~/.asdf/installs/nodejs/*/bin/node -v`? I've never seen it not add at least 100ms.

comment 3y ago · link · parent

I haven't, thanks for sending. It's interesting that it hooks into the "not found" hook of the shell so you can run things like `node^18 --version`.

I also really like that it has really clean install output.

1
567
16