Hacker Newsnew | past | comments | ask | show | jobs | submit | pbadenski's commentslogin

To what extent writing your code in WebAssembly (eg Rust) can help with those points (eg structs in C argument). It would still run in a JS VM so I'm guessing a bit, but not to the full extent?


WebAssembly helps a lot, but doesn’t solve the jit issue.

WebAssembly also introduces its own issues since it’s a BYORT system (bring your own runtime). So, there’s more to JIT (your language’s whole runtime) and more to hold in memory (your language’s whole runtime). You might say, “but pizlonator, every language has a runtime”, to which I’d say: yes but usually that shit gets shared by every running instance somehow. In WebAssembly every instance pays for its runtime’s memory footprint and it’s quite likely that every instance has a different runtime so the code isn’t shared either. Basically, WebAssembly is knee-capped on memory footprint by design. JS isn’t.


Your comment seems substantially misinformed or inapplicable.

WebAssembly has no truck with JIT. Just-In-Time compilation is all about not performing optimisation ahead of time, but only doing it when the code in question is used, and guiding the optimisation by how the code is being used. In WebAssembly, the conversion from the binary .wasm format to machine code is a comparatively lightweight process with no real optimisation of this form: rather, such optimisations must be done as part of producing that .wasm blob (in regular compilation possibly with profile-guided optimisation to go even further than JIT can).

So instead, when you’re using something like Rust (as distinct from, say, compiling CPython or V8 to WASM), what you’ve got is a fairly small amount of what you’d probably call runtime code (allocator, panic mechanism, str, Vec<_>, some other parts of the std crate), probably something like 25KB (or with a little care and compromise, more like 5KB) except when Unicode tables are required, compiled from WASM byte code to similarly-sized (though I don’t know the real ratio) machine code faster than it can be downloaded. That’s code memory usage; for the data memory usage, well, your Rust/WASM will normally blow your JavaScript out of the water there with much more efficient packing of data into memory, even if you’ve got a fair bit of overallocation.

The fact of the matter is that the runtime parts which can be shared for JavaScript are actually not all that large, and routinely dwarfed by included libraries (React, &c.). WebAssembly is by no means knee-capped on memory footprint; rather, so long as you’re using it in a sane way (Rust, standard WASM optimisation and code-shrinking techniques, that kind of thing), there’s a pebble in the way that you’ll notice if you’re a beetle, but if you’re even rabbit-sized you probably won’t even notice it.

As regards pbadenski’s comment: WebAssembly does not run in the JavaScript virtual machine, it’s a completely separate thing that is merely able to call and be called from JavaScript via a foreign function interface. The backing memory buffer may also be accessed from JavaScript, but that’s immaterial in the consideration.


The wasm blob has to undergo the hardest parts of optimization to get native code from it. You need to select instructions and allocate registers. Those things are time consuming; they are on the same order of magnitude of time consumption than most full compiler pipelines.

Compiling wasm to native is only faster than downloading if you compile without optimization. That’s common in wasm VMs but then there’s an optimizing JIT that runs adaptively later, just like a JS or Java VM would do.

The fact that JS VMs share the ICU implementation between instances is a huge deal. That’s not the only thing that gets shared. Also, it’s not about just sharing code; it’s about sharing memory for the runtime’s state and for allowing elastic reuse of space for objects. In wasm the sharing is page granularity at best.


This article is really a reiteration of a https://wiki.c2.com/?SufficientlySmartCompiler argument. I would've sticked to a massively less appealing, but more closer to reality: "We've been lied to: JavaScript is pretty fast, but..." argument.


We tried to use it a year ago or so, because of the performance promise. We were getting random glitches every few thousand files during operations. There was no obvious pattern, so difficult to reproduce, and as far as I remember there was mentions of it in github. Hopefully they acknowledge and get over this hump, as it seems like a promising project all together.


Yep, same experience unfortunately


I'm a bit speechless... Can someone explain how does this scheme can even exist? It sounds preposterous.


Apple chief of security was recently indicted on a charge of a bribe to Santa Clara county sheriff, and the case was dismissed last month. There are 3006 counties in US, and one can let the imagination run wild :)


I don't want to take away anything from your argument but that case is a bad example. There was no evidence to show corrupt evidence and it was dismissed as such.

https://www.mercurynews.com/2021/06/01/santa-clara-county-ju...


This is big! Can't wait until we have radios that can also show images.


Lmao. And good thing we have BBC covering this technology breakthrough.


For me personally, it's really important how productive a language environment is after a few years of development. Therefore:

- debugging environment

- memory and CPU profilers

- compilation and linting time of 100k+ codebases

- IDE support for 100k+ codebases

- static analysis & software architecture metric tooling (complexity, dependency analysis etc.)

- inherent scalability of the language, maturity of patterns & practices of scalability


ALL Java developers should be required to watch this course (it's Free):

https://software-mastery.teachable.com/p/uncommon-sense

FYI: I am NOT an author of this course.


That's interesting - I hate wasting food, I have never complained about my order (and not planning too, unless the food is spoiled I guess). If I don't like the food, I'll just never order again from the same place. I would definitely appreciate a company that offers money refund on food "no questions asked" even if I was never going to use it - it shows respect.


In the US, Aldi, and I think some other grocery stores do this.


Surely, you must have sampled ethanol? ;)


This type of empty fear mongering comment is unhelpful at best. It's a McDonalds of a comment. What's a lot of people? Why are psychedelics so special compared to anything else (sugar, Facebook, gambling). "It doesn't happen to everyone, but it's common" - what does this even mean? "Common" based on what criterion? How should our behaviour as a society change based on your comment?


It seems to be an appropriate response to an anecdote.

"I've seen it work"

"I've also seen it fail"


Agreed, I'm not here to insert my opinion about the therapeutic qualities of psilocybin, but I find vague anecdotal quips like this very frustrating. If there's validity to these treatments, let's let the science prove out. There's no point in trying to discourage folks from having an open mind about something that may turn out to help a lot of people.


Psychedelics can definitely trigger or exacerbate mental health issues. A few years ago my group of friends lost someone to schizophrenia after he started micro-dosing LSD daily.

I've tried many of these substances, and know people who have gone a lot further, so I'm not speaking out of ignorance here. There are risks to these things, and it's not a positive experience for everyone. Giving people a warning about that is entirely reasonable.


It's such a shame because I've seen people lose their minds on psychedelics and the problem is they just can't handle being out of control. If their view on the world is in any way distorted - they cannot handle it. And that's sad because life is ultimately about perception and changing your perception is usually a good thing.


It's not a useful warning, though - what would someone do with that?

It's like saying "driving in a car is dangerous, and many people art hurt every year doing so." Okay, so what? Are you saying everyone should stop driving? It's just not useful - compare it to something like telling people to wear a seatbelt or pointing out that driving in particular conditions is especially dangerous. Those are things that we can use to drive more safely. Saying vaguely that driving can be dangerous doesn't serve any useful purpose.


Because many people in this thread have no knowledge or experience with these substances, so giving them accurate information is useful. I'd say it's even necessary given there's a group of enthusiasts that very clearly over hype the benefits and make absurd claims like it's impossible to have a bad time, to over use them, etc. I want people to have a balanced view of what they may be interested in trying, vs that nonsense. Otherwise they're possibly setting themselves up for a bad trip at the least.


https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7034876/

Be conservative with dosage, don't do multiple doses in the same session & don't use with other drugs


I don’t know if they are “special” compared to those, but you seem to imply they are the same.

You seem so laser focused on the promising side of things that you completely “forget” each substance is different and it’s use has serious consequences if abused, if not then do heroine.


Oh I definitely don't think it's the same. I would argue the items I have listed above are significantly more damaging to society than mushrooms.

On the subject of heroin, what about more dangerous psychoactive substance - ethanol? See https://www.bbc.co.uk/news/uk-11660210 and https://www.ias.org.uk/uploads/pdf/News%20stories/dnutt-lanc...


Are you comparing psychedelics to sugar and social media?

Unless psilocybin is thoroughly tested and validated as a treatment that is as safe as SSRI, I don't think it's really worthwhile to jump into the psilocybin train.


In a sense, yes - I believe the damaging effects of sugar and social media on the society is far greater than psychedelics might have if decriminalised.

They definitely don't deserve to be Class A in the UK and Schedule I in the US. Even more so, they shouldn't be classified as Schedule I by the United Nations.

I'm not sure about using it regularly, but people have been using these for ceremonies for centuries. I personally believe the choice should be left with an individual.


Fortunately, "as safe as SSRI" is a pretty low bar.

Should we also compare the risk of addiction/dependence? Oh, yes, lets do!

Hey, while we are at it, shall we also compare effectiveness? 2 doses vs 6 weeks? Oh, wait, that's what the study did.

I wonder how many different types of psilocybin they had to test to find the effect one for these particular patients. Because, you know, getting the "right" SSRI based coctail is actual quite hard, many people go through three or four different variants before finding the one which they think works.

Yes, I'll bet they had to compare at least as many types of psylocybin before they found the combo that worked. Right?


SSRI's can be not terribly safe as well. In some people their use leads to extremely unsafe impulsive behaviour and which itself can lead to suicide.


Yeaaa, SSRI isn't safe by any means.

It won't kill you for sure. But a 100% loss in sex drive isn't really something people actually want. Took a year after stopping SSRIs to get back.


At the doses in question here, SSRIs have a terrible side effect profile when compared with psilocybin.


SSRIs are notoriously NOT safe. In younger people, they often increase suicidal ideation. Even in adults, there is a very dangerous period when you first start taking them where suddenly you have more energy, but you are still massively depressed. People die because before they were so depressed they couldn't even take action to suicide, and the drugs give them just enough of a lift that they can.

Apart from that, there's the massive list of side-effects, many of them extremely common.

Complete loss of libido, erectile dysfunction, or worse, your libido is unchanged but you completely lose the ability to orgasm.

Insomnia, cause that's what a depressed person needs, even less sleep and more time for rumination in bed.

Akathisia, which is an uncontrollable need to move your body, think restless leg syndrome but it's your entire body. You literally cannot sit still.

Less life-destroying but still very obnoxious: increased sweating, dry mouth (which can ruin your teeth if you don't manage it with biotene or gum or something), blurred vision, headaches, the list goes on.

This is without even mentioning the risk of serotonin syndrome yet, which can straight up literally kill you if you don't make it to a hospital. It happens when your serotonin level is too high, and can cause seizures, fever, arrhythmia, or death.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: