Better HN
topnewbestaskshowjobs
Log inSign up

rtpg

21,278 karma · joined Nov 23, 2012 (14y ago) · 6,746 submissions

real name: Raphael

blog: https://rtpg.co

email: raphael at above domain

Submissions

comment 3y ago · link · parent

I think you are misunderstanding things. This makes it easier for WASM-compiled programs to favor non-blocking mechanisms when being compiled. It's just that the source language might express this without an async layer.

The fact is right now if the source language has a notion of blocking calls, the when compiled to a non-blocking target like WASM it currently has to do a bunch of tricks that outright makes things slower. WIth these improvements, those "blocking calls" can properly end up non-blocking at the JS layer, matching what we all know computers can do.

JS stuff is non-blocking because of the original sin of Javascript (we have to execute all the JS before we can render a page, since there can be some document.body = ... nonsense in there). This is incidental to the programming model, and not some deeper truth about how things should be programmed.

Case in point: non-blocking `async` code in Javascript ends up sometimes turning into blocking code for performance reasons in specific cases (when awaiting an already completed promise, notably). Jumping in and out of an event loop isn't exactly efficient either.

comment 3y ago · link · parent

For me, the huge missing link (that is fortunately being worked on!) is being able to (in a performant way) have a good answer for "host code wants to do some blocking operation, WASM should suspend during the operation".

This _should_ be gotten thanks to work on stack switching in WASM. As of the most recent working group meeting on this [0], it seems like V8 has made a good amount of progress on this. They published a thing back in January[1] on this, and hopefully if things go well and this is available across WASM engines then there will be one less "JS-ism" (everything async) that causes issues for transpilation.

[0]: https://github.com/WebAssembly/meetings/blob/main/stack/2023...

[1]: https://v8.dev/blog/jspi

comment 3y ago · link · parent

I had this for laundry at school in France! I recently was at a US university, and having to use an app and sign up to start my laundry was something awful in comparison (though I liked getting $5 in free credit for some unknown reason)

comment 3y ago · link · parent

I feel like the fact that stuff like Fate and Tsukihime get all-age releases on home consoles is some data point to consider. That and the fact that F/SN is an amazingly long thing (like 50+ hours of reading?) for the handful of scenes... I mean that's a lot of work if it's for a CG pack!

comment 3y ago · link · parent

Disclaimer: Pythonista

I had an opportunity to be exposed to Python and Ruby at roughly the same time.

Python the IPython notebook had started showing up, and the dust had settled a bit on the Py2 -> Py3 transition. So while I was working on a Python 2 codebase, the general vibe of the community was "let's not break more stuff". Pseudocode -> Python translations were pretty straightforward.

Ruby, the entry point was Rails. I bought books on Rails, could not for the life of me figure out how files got noticed by the project or not. I wanted to do something like passing in a function, went on an IRC channel, got yelled at for not doing things the "Ruby" way. Lots of "clever" methods on objects that were neat but didn't really look like pseudo code.

My experience was deeply coupled with Rails, and I think in an alternate universe where I was using Ruby for scripting I would have come out with a different feeling. But Python mostly had no blocking issues for me (a person who was programming for a while at that point), and Ruby was a bit of an undecipherable thing from an operational perspective (even if I could look at a code fragment and understand how it worked).

comment 3y ago · link · parent

> For example, lets say I gave a simple coding puzzle (think leetcode) to 10 python engineers. I would get at least 8 different responses. A few might gravitate around similar concepts but they would be significantly different.

I get what you're saying, but I don't think that's as true as you mean. I think that most experienced Python developers tend to gravitate towards the same style of solutions for things like coding puzzles (including the classic "read in data, map it through a comprehension, write out data" pattern).

There are multiple ways of expressing the same thing, but very often in a specific context one of the ways tends to be overwhelmingly a better fit than the other.

comment 3y ago · link · parent

I don't think "you can define + on custom data types" to be the same as implicit behavior.

"Explicit is better than implicit" is more around things like Django not just automatically importing every directory it sees (instead requiring you to list the apps used). It's also a decent rationale for changes made from Py2 to Py3 regarding bytes-to-string conversions needing to happen explicitly.

It's also about how usually you end up explicitly listing imports (wildcard imports exist but are pretty sparing), or lacking implicit type conversions between data types.

This stuff is of course dependent on what library you are using, the projects you are working on, etc. And there's a certain level of mastery expected. But I think the general ideas exist despite the language allowing for much more in theory.

comment 3y ago · link · parent

I've found that lots of dictionary dispatch in Python ends up feeling a lot nicer as class attributes. You get nicer typing properties, autocomplete, don't need to type quotation marks in many places, and you don't end up in the weird "use lambdas or define functions and then refer to those in the dictionary".

Of course if you're trying to do a registry-pattern style thing the constraints are different (though there I also think that you end up wanting to base your stuff on classes whose metaclass registers itself based on a string-y class attr or something...)

Though in the end it's super dependent on what kind of code you're trying to write. No rule is absolute, especially in this category of aesthetics.

comment 3y ago · link · parent

I would like to pose the claim that distributed computing is probably not more complicated than the distributed production of automobiles.

Maybe The Toyota Way is actually bunk from the get go. But if you buy into the idea that it does work, then why would it not be applicable in software development? This is the core thing that interests me.

comment 3y ago · link · parent

That's interesting, I had never considered "main branch is red" as a similar fail state to the Toyota case, but I totally agree with that comparison!

comment 3y ago · link · parent

One could only speculate on the cause here without more info. I am reminded of reading The Toyota Way a while back, which does talk about how they would shut down lines for any defect. A coworker of mine was pretty adamant that this was A Good Idea(TM), but I thought about how much of IT best practices are about uptime and doing (often principled!) workarounds when you have operational issues, and moving forward in a degraded state.

I wonder if there are IT operations that do try to aim for the ~no defect approach like this.

comment 3y ago · link · parent

Jules Verne is an interesting example, because his books often have themes about traveling more than anything. I feel like at the time (and now!) major projects to just go somewhere were seen as "rich people hobbies". Things are "easier" now for things like mountain climbing but even now most undersea exploration is just financed out of rich people's pockets.

In a world where artificial satelites aren't a thing that is a useful good, I doubt that NASA exists.

comment 3y ago · link · parent

The fact that Texas had a thing like this being built only for it to get mothballed by angry GOP members mad at the _concept_ of a train is so depressing.

comment 3y ago · link · parent

I've said this in other places, but the biggest issue with the Surface lineup is that the Go line is ... just garbage performance wise, absolutely unusable in my experience (despite really really wanting to use it, and basically just using it for PDF annotations!). And the Pro line is good! But it has no 11-inch line and (importantly) it costs so much compared to iPads. If you are looking for a high-end tablet with some pen/pencil input, an iPad Pro 11 inch is the cheap option!

It's kind of frustrating, because I think what's happening here is that the Surface Go line makes a lot of money, and a 11-inch-but-fast thing would probably be popular but have less juicy margins.

comment 3y ago · link · parent

Yeah I recently bought an iPad because the surface is either too slow to be usable or like double the price or an iPad

I just wanted a tablet with good software, and the surface is so close to being that but the Go is a disgrace. Even an instore Go 3 barely handles opening Edge. Edge!

comment 3y ago · link · parent

Even in places as English friendly as the Netherlands or Germany, working with locals is going to be smoother with a grasp of native tongues of the people you’re interacting with.

And if you’re actually interested in riding the ranks as a career it’s a must that you can be able to work in the language comfortable for your superiors (in some places that’ll be English, of course…)

It’s possible to not have it, but every successful outsider I’ve seen in foreign countries learn the local language even if it’s “unnecessary”

comment 3y ago · link · parent

This is a thing that people say, but this is incorrect.

Classic example: Multitenant DB. I have a user table. I have a document table. I have a client table. documents and clients are key'd to user. In particular, there's a property of the system that document.client.user == document.user.

I do a "naive" query to count the number of documents per client, like:

- select count(*), client_id from document where document.text ilike %searchstring% and client_id in (select id from client where user_id = 1) group by client_id;

Now, it turns out that since I have this multitenant data, I have indexes alongside things like (user_id, client_id) on document. I also want to support text search so I have an full-text-search index on (user_id, document.text).

Without properly "guiding" the filtering (usually re-repeating the "where user_id = 1" fragment on every joining table) I will not be able to take advantage of my FTS index, because Postgres decides that's not slow (and _doesn't know about the relation between document.client.user_id and client.use_id). It instead tries hard to implement this either by pulling all of the client documents into memory and then doing an ad-hoc search there, or doing a FTS across all tenants (because I have an index on document.text for cross-tenant searching in an admin), and then scanning through that and removing by client_id.

This is a query plan I would not write if I wrote it myself, because it would be "obviously wrong". It would be a lot of work and clearly incorrect for what I want.

Meanwhile people writing features like this add indexes specifically to support certain workflows, and are often blissfully unaware that those indexes are not being used when it makes the most sense. Of course you gotta check experimental data and measure etc etc. But I like the idea of doing more data design before you start having performance issues, and I think that explicit index usage in particular would be a huge benefit on that front.

(there is a "fix" for the original query, involving repeating the user_id filter at other levels)

comment 3y ago · link · parent

The basic idea is that file IO and socket IO will allow a task to be suspended while the IO is happening, and let another task do its work.

On top of that, you can write a C extension that will let you run compute heavy work in a way that allows your task to be suspended (for example, the C extension spins up its own thread). This extension has to be "very careful", basically by avoiding touching Python-side data during this work.

The way this sort of stuff ends up working is you pass data into a C extension, and that extension takes ownership of the data or copies it or whatever, does what it needs, then gives Python back some result.

But if you're just pure-Python compute heavy, then your task won't be suspended. So everything will run, but your compute-heavy stuff will hog the CPU, and won't be suspended. (Though if you have compute heavy work that is, like, looping over data, you could add `sleep(0)` between every couple of iterations. This gives other tasks a chance to run! This could be good enough to prevent weird bottlenecks).

But the ultimate thing is if you have N compute-heavy tasks, you probably won't get speed advantages. If you have 1 compute-heavy task and N IO-heavy tasks, you can get advantages (even if the IO-heavy stuff is interspersed). But if you have N compute-heavy tasks and not much IO-heavy tasks, multiprocessing can get you where you want (since it's usually IO-heavy stuff that is helped out the most with async/await)

comment 3y ago · link · parent

One of my side ideas is to write a postgres plugin offering an alternative syntax for queries, but one that requires you to name the index you use (or to explicitly mention a table scan).

I do understand the value of SQL + the planner for adhoc querying. But so many times I find myself reworking SQL to hint at the planner to use certain indexes, or to add "spurious" filters to make sure an index is used (spurious for application logic reasons). For applications with a relatively low cardinality of queries, some extra tedium might be worth stronger performance property guarantees.

Added advantage of the tedium is it would make a lot of "accidentally quadratic" stuff much clearer. There is no magic in the planner after all!

We can write inline assembler in C or Rust, it feels like it would make sense to offer something similar in SQL. Big problem is how to offer something that isn't too tedious.

Anyways FQL's index model seems to align with my idea, just unsure if I want the rest of it.

comment 3y ago · link · parent

My understanding is the reprocessing is more about trying to recover uranium and have a somewhat closed cycle rather than constantly try and import uranium from mines? But my understanding is limited

comment 3y ago · link · parent

But that's the point, really. Nuclear reactors are not economical if you're not really going for it, so in an environment where you are relying heavily on nuclear reactors, suddenly your entire endeavor is not very practical without massive state aid.

This is less of a problem in other places that have less nuclear power setup because they can be used to cover the baseline. Now, EDF is turning off reactors over the weekend cuz the power isn't needed, and in periods of high demand EDF doesn't actually have the capacity, because they don't have much peak generation!

Building more nuclear plants to cover peaks would make everything even more expensive, And decomissioning reactors entirely would cause their own massive issues because, again, electricity generation is not fungible.

One would (correctly!) point that most renewables don't help with peak generation either, and you would be right. But if you're planning on decomissioning a nuclear power plant, replacing some of that capacity with renewables at least gets your operating costs down. And energy storage solutions that are more fungible... well... you walk and chew bubble gum. Use what you have, and build what makes sense. Just in 2023 your choices for clean power generation for energy storage are vast.

comment 3y ago · link · parent

Japan does fuel reprocessing for its nuclear reactors, my understanding is that this allows them to just not need to import any more uranium. I believe there is still some waste product at the end of all of this, but it is a very manageable amount of it? That's my understanding at least.

comment 3y ago · link · parent

France is a nuclear success story, but they're also a good indicator that even when you're all bought in, there are logistics difficulties that come from your power generation being centralized to certain locations.

France has like 80% nuclear power, and most of the nuclear plants are actually underutilized! Why would France not use the plants at 100%? Because electricity is kind of fungible, except at massive scales where it totally isn't, and you can't "just" have power generated in the south be used in the north.

Nuclear is more expensive than gas, but once again it is worth pointing out that it is more expensive than solar and wind! Does this mean that we can replace all of the reactors with solar or wind? Obviously not. But if you're sitting there trying to produce energy in places that are not as close to the existing reactors, building energy production facilities that don't take decades to build (for "building big things takes time" reasons) and can work without a constant inflow of water (which is a practical and real concern for these power plants).

comment 3y ago · link · parent

I don't really feel the need to shut down nuclear stuff, but my impression from the past couple of years of these discussions is that nuclear is not only super costly, but logistically very hard (ignoring regulatory environment issues! Just logistics), and is just super hard to pull off. Meanwhile lots of other things have shown up, are very cheap, don't necessarily require huge water inputs, etc.

France is the nuclear success story, of course! But the irony is that these power generators can only make money when used at 80-90% capacity. France's reactors don't get that high, and so they're quite a money pit. There's the argument that "losing money" generating power is fine (we don't expect to make money on libraries or streets), but it's important when people argue about regulation being the problem. The most open and willing ecosystem for nuclear power is one that exists due to massive state subsidies.

Yeah lots of renewables aren't 100%, but power is power is power, and it feels like doing a bunch of easy stuff that also happens to make money for private actors (sidestepping some of the trickiness of larger gov't-funded projects) is a thing that our modern society is well oriented towards.

EDIT: to be clear, if there was a huge pro-nuclear movement that showed up tomorrow that could get things done, I'd be all for it. I just like the idea of doing easy things that are accepted by wide swaths of the population rather than just sitting around lamenting that people are "being irrational" or w/e

comment 3y ago · link · parent

I mean I get what Daniel's saying, but I kinda doubt there wouldn't be _some_ speedup. And hey, what if type checking for small programs went from half a second to 100 ms? That would be nice!
1
525354
225