HNHacker News
TopNewBestAskShowJobs

gjulianm

4,409 karma · joined November 21, 2011

Mathematician and computer engineer.

http://twitter.com/gjulianm

[ my public key: https://keybase.io/gjulianm; my proof: https://keybase.io/gjulianm/sigs/nfNutn3AksS22AzUBMHIkR3wqz46pUi-dOCF6GN2SbY ]

submissionscomments
gjulianm··on What's up, Python? The GIL removed, a new compiler, optparse deprecated
It's always a tradeoff, but I'm surprised to see so many people say that just because Python isn't fast it shouldn't get multithreading.

Yes, by using Python we leave a lot of performance on the table. We also get a lot of dev performance, just because of the amount of libraries available, dynamic language features, quick development.. So it's not always a clear decision between Python or a compiled language.

> If you need something to be fast you are supposed to use a C extension and control it with Python

So what do we do with the case where we need to control the C extension from multiple threads? Because that's currently my problem. The C extension we developed do release the GIL, but because the Python code that does the calls to the extension can't be really multithreaded, the performance gain we get is minimal.

gjulianm··on What's up, Python? The GIL removed, a new compiler, optparse deprecated
But thread-unsafe code is not the same as incompatible code. That's the point. You can just choose to say "NOT THREAD SAFE" (just as many C libraries aren't thread safe and need to be wrapped in locks to be used by multiple threads) and users will still be able to use it. More importantly, if it's a pure Python extension, you can just not modify the library and the users will still be able to use it whether or not they have gil or no-gil.
gjulianm··on What's up, Python? The GIL removed, a new compiler, optparse deprecated
You're missing something, which is that a lot of libraries will be "i-don't-care-about-gil". Only native extensions need to choose GIL or noGIL due to the ABI difference, but pure Python libraries should run with the same code in both variants. And a lot of them will probably be thread safe at some level (function or class) without any changes. For those that aren't thread-safe, I bet that quite a lot can just get away with a "NOT THREAD SAFE" warning and letting the user wrap access to them with locks.

And that's talking about multithreaded code. I bet that even with noGIL, lots of Python code will still continue to be single-threaded, making the gil/no-gil decision irrelevant (save for those native extensions).

gjulianm··on What's up, Python? The GIL removed, a new compiler, optparse deprecated
Which code is automatically going to run in threads? As you say, basically nobody uses Python threads. So even enabling no-gil, nothing is going to change because sequential code will still be sequential.
gjulianm··on What's up, Python? The GIL removed, a new compiler, optparse deprecated
I'm one of those happy to see the GIL removed. I've had troubles with the 2->3 transition and more recently with the 3.6 EOL, which wasn't as traumatic but still a little bit troublesome. Despite that, I prefer another transition and being able to actually use parallelism in Python rather than rewriting a huge codebase in a different language, and losing the advantages of Python.
gjulianm··on Intent to approve PEP 703: making the GIL optional
> is there any use case of No-GIL which is not solved by multiprocessing ?

Tons:

- A web server that responds using shared state to multiple clients at the same time.

- multiprocessing uses pickle to send and receive data, which is a massive overhead in terms of performance. Let’s say you want to do some parallel computations on a data structure, and said structure is 1GB in memory. Multiprocessing won’t be able to deal with it with good performance.

- Another consequence of using pickle is that you can’t share all types of objects. To make matters worse, errors due to unpickable objects are really hard to debug in any non-trivial data structure. This means that sharing certain objects (specially those created by native libraries) can be impossible.

- Any processing where state needs to be shared during process execution is really hard to do with the multiprocessing module. For example, the Prometheus exporter for Flask, which only outputs some basic stats for response times/paths/etc, needs a weird hack with a temporary directory if you want to collect stats for all processes.

I could go on, honestly. But the GIL is a massive problem when trying to do parallelism in Python.

gjulianm··on Intent to approve PEP 703: making the GIL optional
I think there are several reasons:

- The history is backwards: it isn’t that devs wanted to make a native library and then chose Python, it’s that they chose Python and then they needed a native library.

- Python works very well for scripts and small programs, and decently well for medium-size programs. This makes libraries with concrete purposes very useful and productive. If your library, say, helps devs do some basic calculation with time series, the ability to be used in quick scripts is a big plus.

- The C API is fairly good, and libraries such as pybind11 make it even better. You don’t need a lot of code or boilerplate for an extension.

gjulianm··on When did people stop being drunk all the time?
> Yes, I understood that. However this is new information for me. Where did you get that?

There's not a lot of evidence that links sugar intake to cancer risk directly, when controlling for weight. Sugars aren't in the IARC list either. And the link between high sugar intake and obesity is clear too.

Obesity, though, is a well known cancer risk, and for quite a lot of cancers there's causal mechanisms proposed.

> Where are those studies? In vivo? In humans?

The IARC monograph has the details of the evidence collected to declare processed red meat as carcinogenic and unprocessed red meat as probable carcinogenic, and of course it includes studies in humans and studies that separated processed/unprocessed https://monographs.iarc.who.int/wp-content/uploads/2018/06/m...

> You mean greater longevity, better mental health (less depression, less anxiety, …), better cognitive function?

I find it funny that you're asking repeatedly for sources for things that are repeated by every health agency in the world, and then just drop these claims with nothing to back them up.

> Let's say processed sugar.

But no one was saying "processed sugar". The diet I started criticizing was an all-meat diet, with the comment even criticizing fruit.

> If you stop eating something and in consequence suffer from malnutrition then that won't be "easy" to keep up in the long term.

You won't suffer from malnutrition by not eating red meat. In fact, most scientific diet recommendations include the limitation of red meats. You will, however, suffer from malnutrition if you withdraw from all foods that contain natural sugars, because that includes almost all fruits and vegetables.

If we talk about added sugar, diet recommendations usually include limiting its intake too. However, the point I was making in my original comment is that there's far more evidence linking red meat consumption to cancer risk than for sugar, and therefore I can't really trust the advice of someone who claims that an all-carnivore diet is better "because it has no sugar".

gjulianm··on When did people stop being drunk all the time?
> I have never heard of this. Where did you get this?

I meant that sugar causes cancer through obesity, not that there's an intermediate step between sugar and obesity.

> Bacon aside, there is no proof which shows that red meat causes cancer. Yes, there are studies that show a correlation between red meat and cancer. However those studies did not differentiate between fresh unprocessed red meat and other processed meat like bacon, sausages, etc.

Most studies do differentiate between unprocessed and processed red meat. And the correlation is fairly strong, not to mention the rest of health effects that a diet high in red meat is associated with.

> I'd argue the opposite, bacon aside. Red meat is a highly nutrient dense food. Sugar on the hand is just empty carbs, Metabolizing sugar will drain you body of important vitamins (e.g. B1).

Do you really think it's easier to take out sugar of your diet? I think the only way is to go full carnivore (not even milk or its derivatives). On the other hand, you don't even have to go vegetarian to remove red meat and bacon from your diet.

gjulianm··on When did people stop being drunk all the time?
Here is more detail about the mechanisms by which they could cause cancer: https://pubmed.ncbi.nlm.nih.gov/30376922/

And yes, all bacon, by definition, is processed meat according to WHO's definition. Bacon is salt-cured meat and the WHO considers processed meat as "meat that has been transformed through salting, curing, fermentation, smoking, or other processes".

gjulianm··on When did people stop being drunk all the time?
The evidence is well known and any Google search will produce it. Here's a document from WHO: https://www.iarc.who.int/wp-content/uploads/2018/11/Monograp... Spoiler: bacon (as it's a processed red meat) is classified as carcinogenic (Group 1), red meat as probable carcinogenic (Group 2A). There are quite a lot of analysis showing there's up to a 50% increase in overall cancer risk due to eating red meat and up to 70% with processed meat https://www.sciencedirect.com/science/article/abs/pii/S03088...
gjulianm··on When did people stop being drunk all the time?
Well, sugar needs an intermediate step to cause cancer, obesity, which is something that can be controlled. Not to mention that quite a lot of foods have sugar in them and you can't really take it out. On the other hand, red meat and bacon are known direct cancer risks, which you can't control, and you don't really need bacon and red meat at all, it's something that you can easily take out of your diet.
gjulianm··on When did people stop being drunk all the time?
Not really, and the link between red meat and colon cancer is very well established and significant, much more than the alternatives.
gjulianm··on When did people stop being drunk all the time?
I can't really trust the nutritional advice of someone that deliberately loads up on things like bacon and red meat, which are known risk factors for colon cancer.
gjulianm··on Twitter has officially changed its logo to ‘X’
> Give people freedom and let the users decide what they find worthwhile.

Well, as I already said what people find worthwhile is the shorter tweets, it's what generates more engagement. I do agree that one gets more value and depth from longer tweets, but Twitter isn't really a place for value and depth, but for shortness and content density. And also, while threads are not really the best UX, they have a very interesting advantage for Twitter: they allow users to engage and amplify the part they find the most interesting, and that drives more engagement than waiting for people to find the interesting part in a five paragraph-long tweet.

> Whether it's a mistake comes down to how much revenue Twitter makes in blue checkmark fees vs. how much revenue they lost from advertisers bailing. I'd need to see some hard numbers on that before being able to call it a mistake.

Well, we don't have the exact numbers but Elon Musk already said that ad revenue fell 50% and cash flow is negative. IIRC, Twitter was cash flow positive when he bought them if you didn't take into account some one-time expenses.

gjulianm··on Twitter has officially changed its logo to ‘X’
> Removing the tweet limit was a massive improvement

The essence of Twitter is precisely that the tweets are short, bite-sized thoughts. It's what drives interactions and engagement, removing the limit shows a lack of understanding of what makes Twitter Twitter. And I assume that most people aren't even using the limits even when they're paying Twitter blue, precisely because they know that it's not how you use Twitter.

> Showing view counts is also nice

I don't know if they have fixed this, but those view counts were fairly inaccurate.

> I don't like the login-walls and selling blue checkmarks, but I understand that the company was financially struggling prior to Elon.

The login walls and the blue checkmarks are again a massive mistake that is driving away brands and institutions from the site. Now their statements aren't visible to everyone, and people can't even be sure which one is the official account because the already existing symbol that said "this account is who they say they are" now just means "this account paid for Twitter".

gjulianm··on Cython 3.0 Released
I haven't used Cython too much, it does look really interesting but the translation layer worries me a little bit for more complex modules. However, I've been using pybind11 extensively and it's a delight. Well designed, documented, predictable, removes a massive amount of boilerplate, integrates perfectly well with C++ idioms (e.g., smart pointers), and doesn't completely lock you in, as you can still call the C API in a regular way.
gjulianm··on The C Programming Language: Myths and Reality
I think that at this point this is a discussion about semantics, just as this other commenter pointed out: https://news.ycombinator.com/item?id=36758407

Yes, you can do something in C that somewhat resembles encapsulation. You could also do it in Python with a decorator that inspects the caller. You can also do inheritance and virtual functions in C. You could do anything in a Turing complete language. But usually when talking about "X language has Y" refers to whether the language has Y as part of the specification. In this case it isn't encapsulation as part of the specification (that's why it comes with all those downsides/extras) but as an artifact of other aspects of the language, that's why I say it's not really equivalent.

gjulianm··on The C Programming Language: Myths and Reality
LTO isn’t always going to inline things you want it to inline, that’s the main issue I have with it.
gjulianm··on The C Programming Language: Myths and Reality
Out of curiosity, how would you do it? The ways I've seen require using another "public" struct and either casting public to private or using a nested pointer, each with their set of problems. In either case, it's still a bit hacky and still each struct is all-or-nothing public or private.
gjulianm··on The C Programming Language: Myths and Reality
As the other commenter said, and I want to reiterate, what led me to start with the talk about the private keyword is the big bold header that says "Myth: C has no equivalent to “private”" and the first code snippet that shows how you can have "private" fields in C++ and the following ones that show an "equivalent" implementation in C. So I think it's reasonable to infer that the author is talking about encapsulation and "the private keyword" as somewhat interchangeable (and I don't disagree, for this discussion they're practically the same). Not only that, but the points I made are about the implementation shown in the article, which is independent of whether the talk is about "private equivalency" or "lack of encapsulation": the gist of it is "yes, you 'encapsulate' things but not in the same way and it comes with disadvantages that aren't really there in other languages".

With all that said, I don't think all that condescending talk about the lack of reading comprehension or skills, without actually going into the arguments themselves, is really necessary or positive.

gjulianm··on The C Programming Language: Myths and Reality
I mean, there's a big header that says "Myth: C has no equivalent to “private”" and a code example about the private keyword, so that's why I started saying that. Even then, my points still apply: this isn't really equivalent to how encapsulation works in other languages due to the lack of granularity and the "extras" of all the usual language behavior that stops being supported.
gjulianm··on The C Programming Language: Myths and Reality
The code sample still isn't equivalent. Now you have yet another pointer, which implies another allocation, another source of possible memory leaks and mistakes, and a separate memory space that will hurt the cache.

> Those are implementation details which are deliberately being hidden.

I know they're being hidden deliberately, but in C++ "private" doesn't break malloc (new), copies by value or sizeof. Or stack allocation, to add to the list.

> They are as incompatible with code inlining as public/private modifiers in C++ are. That is, LTO is your best friend here.

public/private aren't incompatible with inlining in C++. That is, you can call class functions that access private members and the compiler can inline those functions. Also, LTO is not always enabled by default, and doesn't always inline the things you want it to inline.

> Also, have you ever tried to maintain binary compatibility with several versions of a third-party C++ library that keeps adding/removing private fields to/from its classes?

I mentioned binary compatibility as one of the reasons one might want to do this. However, if you have a third party that doesn't care about API compatibility I doubt struct fields are the only thing they're going to change constantly.

gjulianm··on The C Programming Language: Myths and Reality
Yes, that's usually how it goes, each header/source is like a "class". And usually, what you have is a "main" struct that represents the "class" itself. In this case that main struct can't have both private and public fields.
gjulianm··on The C Programming Language: Myths and Reality
I wouldn't call this equivalent to the private keyword:

* It does not work on a field, but on the whole struct. Either all fields are public or all are private. The latter case forces you to write getters/setters for properties you want users to access, and that in C can be even more cumbersome as you need to write the definition in the .h and the implementation in the .c.

* It breaks, without an explicit and specific and error message, several actions. As it's mentioned in the article, malloc isn't possible, but neither are copies by value, sizeof() breaks... And those will break with an "incomplete type" error message, not a "this type is intentionally made private", which can add confusion in some situations.

* Completely incompatible with inlining code. Considering a lot of people still use C precisely for its performance, I think this can be a drawback in a lot of usecases.

I honestly think that hiding struct declarations should be done sparingly, and preferably limiting it to cases where it's actually necessary (for example, a library that doesn't expose internal struct fields so the same executable works with different versions of the dynamic library; or proprietary libraries that want to expose as little as possible). In the end it's still easy to bypass, and the distinction between header and code files already provide an indication of which functions you should use and which ones you shouldn't.

gjulianm··on Understanding Kafka with Factorio (2019)
> And by the way, be sure you're ready to sink some time in if you're curious about this game...it's just too good, and I've had to consciously reduce the time I'm spending, because I could just keep optimizing...building...expanding...optimizing...it's built in the shape of the reward center of my brain.

I feel the same. It scratches so many itches. I made the mistake of installing Space Exploration mod after the first run… so many hours invested now.

gjulianm··on Rapid Covid tests miss 90% of asymptomatic cases
> My daughter was sick with 'rona twice last year (the rest of us seem to have never gotten it) and in both cases it barely registered visually just once on the tests after doing many many tests that showed negative.

Well, if anything your experience seems to confirm how these rapid tests work. At least my perception has always been that these were advertised to check not whether you had COVID or not (PCR is the gold standard) but whether you can infect others or not. Your daughter barely testing positive on one out of many tests and the rest of the family not getting the disease are coherent in that sense, as your daughter didn't seem to be specially infectious.

gjulianm··on Rapid Covid tests miss 90% of asymptomatic cases
> this means that level of endemic infection was reached much sooner than claimed by pretty much all western governments

No, it doesn't mean that. An easy reason is that most western governments used PCRs for case confirmations. Another easy reason is that "90% miss on asymptomatic cases" does not mean "90% of all cases are asymptomatic", in fact, quite a lot of "asymptomatic cases" evolve later to "symptomatic cases".

> pandemic probably never really was a problem either to begin with

I already said this in another comment, but it was a huge problem, and a lot of us lived through it and it was scary. You might not have seen it thanks precisely to those precautions you now criticize, but a lot of cities had a very significant collapse of the healthcare system and a massive amount of deaths. Ignoring this reality is incredibly damaging and I don't understand why so many people like you are so cavalier about this.

gjulianm··on Rapid Covid tests miss 90% of asymptomatic cases
> My city had none of those problems

I think you missed the part where I said "Maybe the reason it wasn't for you is that you lived in a place where the government took precautions before it got too big".

> COVID standard of care w.r.t. intubation was uniquely terrible.

That's what happens when you're dealing with a disease that's literally three months old and that's saturating the entire health system. We also gave hydroxycloroquine, which was proven later to be useless. We literally knew almost nothing about the disease, what did you expect? Excellent standards of care from the start?

> Disrupting the daily routines of elders in nursing homes is well-known to drive mortality.

I think that an infectious respiratory disease and the lack of medical care are far more significant drivers of mortality.

Seriously, what is your point here?

gjulianm··on Rapid Covid tests miss 90% of asymptomatic cases
Precisely the point of most of those policies was to use rapid tests to ensure you weren't being infections at that moment or close to it. I honestly don't know what's so controversial about them.
← PreviousPage 4 of 34Next →