Recent submissions

Comment · 4 months ago
Interesting, it's similar to what I've done recently in Koffi 3, which is an FFI package for Node.js. I made my own C FFI layer, I did not use libffi. This works great, and got me close to statically-implemented NAPI modules.

Benchmarks are here: https://koffi.dev/benchmarks

It's still a little different because in my case, the instructions tend to do two things: decode JS value and prepare register/stack. For typical functions, only a few instructions have to run, with minimal overhead. So, for example, I have a PushBool instruction which calls napi_get_value_bool() and then puts the bool at the correct offset (pre-computed) so that it ends up in a register or on the stack.

A function like int atoi(const char *) ends up with only two bytecode instructions:

  - PushString
  - RunInt32 (combined macro-operation that defers to assembly to set up registers, call the function, and then directly decodes the value)
Or another exemple, void *memset(void *ptr, int value, size_t size) only needs four instructions:

  - PushPointer
  - PushInt32
  - PushUInt64
  - RunPointer
I've coupled that with a tail-call direct-threaded interpreter, with Clang's __attribute__((preserve_none)) ABI, just like Python did recently: https://github.com/python/cpython/issues/128563
Comment · 4 years ago
Comment · 5 years ago
I think that in a proper API, we could have:

  int process_handle = spawn("/bin/true", SP_PAUSED); // create process but don't execute, and return a handle
  // most API would take a process handle, thus you could do stuff (such as prctl) on the new process
  unpause(process_handle);
There's a bit of a move in this direction in the Linux API with the PIDFD stuff.
Comment · 6 years ago
Interesting, thanks for the tip! I'm gonna give it a go during the weekend.
Comment · 6 years ago
I share this opinion as well. For centralized-repo style, which is what most teams need, the Git model has three problems:

- It is hard to use. There's a reason most teams have a single or two Git "experts" to help everyone else resolve repository / merge / pull / whatever problems that happen regularly. The onboarding experience for developers unfamilir with Git is very bad, and many of them end up never able to use it. If you have non-developers (e.g. artists), it is even worse.

- Binary files. Yes, there is Git LFS, but there are many small integration problems when you try to use it, and the simple fact that Git needs something special to manage binary files is a problem. And no, storing binary files outside the repository is NOT a good solution. In games for example, the binary files and the engine usually evole together and if you want to checkout an old version, the code and the assets need to stay in sync. You want to version the game, not just the engine.

- Partial (subtree) clones and permissions. There's a reason monorepos are popular: they're much simpler to manage. Unfortunaly, because Git barely does partial clones and cannot manage permissions (inside a repository) at all, monorepos are much more limited than in SVN or P4. That's why many projects end up divided in multiple repos, but this brings all sorts of problems and a large administrative overhead for all developers.

Comment · 8 years ago
Comment · 8 years ago
Comment · 8 years ago
Worldwide, most of the energy that comes from wind and solar is a tiny fraction of the primary energy supply mix. Where it's growing it's mostly used for additional energy, not to replace the exisiting fossil-fuel consumption. This does not help one bit for climate change.

First graph at the top left (which is actually energy consumption, close enough): https://www.bp.com/en/global/corporate/energy-economics/stat...

The important thing in this grap is the absolute values of each source, not their relative importance. You'll note that despite renewable growth (of which solar and wind is only a fraction, there's also biomass and various other stuff), fossil-fuel consumption is still growing faster. Indeed, historically, new energy sources have never really replaced 'older' ones. Each time, the new sources just provide additional power on top of the old ones.

So much for 'decoupling'.

Edit : the US energy article on Wikipedia has an interesting graph that shows something similar (except for a partial switch from coal to NG): https://en.wikipedia.org/wiki/Energy_in_the_United_States#/m...

Comment · 9 years ago
Where the hell do you get your news from? The "massive wind and solar boom" exists only in the media. There's a rule of thumb you can follow here: the importance of a technology / energy source / whatever is inversely proportional to the number of articles about it in the general media (and on HN for that matter).

Geothermal, wind, solar, heat, tide, etc. currently amount to a staggering 1.5% of the total primary energy supply of the world. Coil is at 28%, oil is at 31%, natural gas at 22% (and climbing), nuclear at 5%, etc. CO2 emissions continue climbing year after year, and we should have started going down more than twenty years ago.

Our agricultural system is completely dependent on fossil fuels (oil). Because of that it is mostly unsustainable, and also because it tends to destroy fertile lands (topsoil loss is kind of a big issue).

You are kind of right that the current system can support a lot of people. Unfortunately, almost none of it is sustainable. So making more people is really not a good idea at the moment, because the situation will change drastically over the next 80 years.

Comment · 9 years ago
You are right, there is pretty much nothing in biology that is. Humans are no exception, but until recently it was not a big problem because we did not have the power to significantly damage the climate and the biosphere (though the megafauna would probably disagree).

Fossil fuel powered technology has changed that, but we are psychologically and socially ill-equipped to deal with its transformative power.

Comment · 9 years ago
> People are scared of nuclear energy for the same reason that they're scared of taking an airplane. Even though it's technically and statistically very safe, the perceived risk appears much greater. [...] I'm more worried about global warming than Fukushima and I'd gladly trade even a dozen of Fukushima-type incidents in the next decades (highly unlikely) if it could stop global warming and its dire, hard-to-revert consequences.

I could not agree more, but unfortunately global warming suffers from the exact opposite effect. The perceived risk appears very low to most people, because it is not very spectacular on human time scales. Even though it is by far the greatest existential risk we face.

Comment · 9 years ago
Many / most people exisiting now also fail to grasp how bad the future will get on our current course. They fail to realize that modern life is anything but a short-term artefact of fossil fuel gluttonery (every person in the first world has uses the equivalent of 100 fossil fuel slaves. It's easy to mock human slavery when you can burn such a dense source of energy instead) and mild stable climate, both of which are likely to go very wrong this century.

The decision to put more weight on the present is mostly made in ignorance and wishful techno-optimism. Many people still think that we're somehow building a cheap-energy no-death space-faring future, or they're not thinking about it at all (though that does not stop them from making children). Going to space to escape the hard reality of life on earth and then never dying is basically the techno-optimist's replacement for the now outdated concept of heaven.

People on HN tend to go for techno-optimism. This is readily apparent when the AI, singularity delusion is treated as a grave and imminent civilizational problem but fossil fuel, energy shortage and climate change are dismissed with "PV will solve all of this. Evil greedy subsidy-loving coal and oil companies are the problem". Our fossil fuel powered civilization would quickly beg for these "evil" companies to resume their activity if they somehow decided to stop providing oil for a week.

Finally, this preference is also made at the expense of most of the wildlife and biodiversity that exists now (or not long ago for a significant chunk of it), which would very much like to continue exisiting too.

Comment · 9 years ago
> Ultimately all life on Earth will die when the sun burns out or otherwise significantly changes its output. The only hope humanity has to outlive this is taking to the stars, and that won't happen without consuming a lot of resources.

There's 500M to 1 billion years left for complex multi-cellular life on earth, due to increased solar output. That's around 100000x to 200000x longer than human recorded history. So clearly, not an imminent problem any rational human needs to worry about.

Trashing the planet in a few decades for such a far away "problem" is absurd. All it does is significantly shorten the time we have here. We could decide that 500M to 1B years is enough, stay here and enjoy all the time left.

If we really want to escape our fate on earth, well we could simply take our time to slowly develop ways go to space. Assuming that it is possible for humans to reach anything beyond the solar system, which may not be the case. There are practical physical and thermodynamic considerations that may prevent us from ever colonizing much in space, even if we were to try hard. In which case, preserving earth would not just be the best thing to do, it would be the only thing we can do.

> If you want to look at it in terms of natural resources, personally I think irrational fear of nuclear power is the biggest problem facing the world. Modern reactors pose almost no risk to the biosphere compared to coal, oil and the like, nor do they contribute to global warming. More people die every year from coal-burning related illness than have ever been killed by nuclear power accidents.

No disagreement here. Though it only addresses some of the issues we face, nuclear fission is probably the only semi-viable alternative to fossil fuels.

Comment · 9 years ago
Maybe, but I hope there are better arguments for the current system than "it works better than the Soviet Union". All you have done here is establish that an extremely dysfunctional economy can either waste or fail to use its resources, which would mean that America and Western Europe are not completely dysfunctional. This is a pretty low bar.

And as you said, we're talking short term here. Very short term. On slightly longer terms, it really doesn't look so good. Indeed, it takes an absurd level of denial / techno-optimism / magical thinking (whichever you prefer) to look at paleoclimatology and current climate indicators and think it can go on for much longer without global catastrophy.

At the end, if the best we can say of globalization is "For around 40+ years it was great fun for a lot of people. Well, for the most privileged countries anyway. And then it collapsed, and took a great chunk of the biosphere and the human population with it"... I don't see much to celebrate.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton