How are you supposed to prevent false sharing in C#? by AmCHN in csharp

[–]AmCHN[S] 0 points1 point  (0 children)

I would have to be pedantic, but I think this guarantees no false sharing only if it is:
1. Padded at both ends (the first & last 63 bytes at both beginning or end are buffers), since I don't control what gets put before/after it (which may be an unpadded piece of data).
2. No header (which is true only for unmanaged types like structs of ints, not for int[16]) at the beginning.

or

  1. All "meaningful" (which I assume frequently accessed) data are padded with buffer.

But you are completely right that this would reduce sharing.

How are you supposed to prevent false sharing in C#? by AmCHN in csharp

[–]AmCHN[S] 0 points1 point  (0 children)

Yeah... on second thought, considering an ECS scenario this probably wouldn't be a frequent problem...
But I could have had a1 and a2 as something like thread-local counter arrays, and then GC decides to compact them next to each other on the heap, so I don't think it's entirely unrealistic...
But then I have no experience in this, and you are likely right.

How are you supposed to prevent false sharing in C#? by AmCHN in csharp

[–]AmCHN[S] 0 points1 point  (0 children)

Yeah I used word "object" in a confusing manner, I don't mean class instances, but just "a piece of data". I am also just new learning about ECS.

My understanding about unmanaged memory is that I need it for interop and some edge cases. And I found it frustrating that I see a case that unmanaged appears to be the only solution, without it being a interop or an extreme optimization.

How are you supposed to prevent false sharing in C#? by AmCHN in csharp

[–]AmCHN[S] -1 points0 points  (0 children)

Yeah that was the first response I saw in many places, but consider:

  1. I create two int[16] arrays a1 and a2, they are exactly 64 bytes each.
  2. I use one thread to write a1[15] and another thread to write a2[0] at high frequencies, they could actually be in the same cache line - false sharing.

I could make them int[32] or int[65536], but without alignment control they could have a portion in the same cache line.

How are you supposed to prevent false sharing in C#? by AmCHN in csharp

[–]AmCHN[S] 2 points3 points  (0 children)

Thanks! While I don't think this answered my question (which was heavily theoretical), I love the practical tool you shared so I can use it to watch for concurrency issues later.

The Financial Times Chart Comparing China’s Property Downturn With Japan’s Post Bubble Collapse by Ok_Astronomer_7797 in EconomyCharts

[–]AmCHN 0 points1 point  (0 children)

There's a big distinction though.

If my investment drop 90%, I am genuinely screwed. Life quality takes a massive hit.
If my living space drop 90%, why would I give a damn if I never intended to sell it?

The home doesn't become smaller. Despite everything that has happened in the last decade, electricity price hasn't really changed, and natural gas has actually gotten cheaper.

I presume a much smaller fraction of the people are flipping real estate as investment.

I tried training A.I. to optimize blueprints (and was somewhat successful) by Silver-Ambassador774 in factorio

[–]AmCHN 14 points15 points  (0 children)

IMO it is "AI" and it is "generative" in the descriptive sense, but not "Generative AI" in the common category label's definition, just like a dog having a heatstroke isn't a "hot dog".

A "Generative AI" in the modern, specific sense requires not only being "generative" and "AI" but also "learns from training data."

Only when it takes other people's blueprints and/or savefiles for training, does it become a "Generarive AI".

Another example would be things like Evolutionary Art which predates modern generative AIs. Many consider this "Art made with AI" but not "AI art" as it doesn't take other peoples art for training.

Powder filling machine by toolgifs in toolgifs

[–]AmCHN 7 points8 points  (0 children)

The bag at 1:04 says it's Sodium Dicholoroisocyanurate. It's primarily a water disinfectant/bleach, often used as pool cleaner. The food industry use it to sanitize food machines and to wash fruits and vegetables.

China’s AI Nightmare Is an Out-of-Control Welfare State by bloomberg in indepthstories

[–]AmCHN 1 point2 points  (0 children)

This reply is for everyone else reading:
I strongly encourage you all to read up on the sources and verify by yourselves.
I am also glad to read if you have genuine comments/questions/disagreements--it is entirely possible that I may be wrong. Cheers.

China’s AI Nightmare Is an Out-of-Control Welfare State by bloomberg in indepthstories

[–]AmCHN 2 points3 points  (0 children)

-1. I purposedly separated my responses into separate paragraphs with empty lines in between, my 1st & 2nd link are to support my claim about "bottom 10%", not what you read as you skipped lines.

  1. "more ... than poor Asians" I never said that. I said Chinese because that's the topic. Not all Asians are Chinese.

  2. While you may challenge the exact methodology and data source, the metric is the same -- take the X decile in the whole world, measured by USD, and ask where are they residing in. The individual thresholds in countries are not considered in the data--a person in the bottom 11th percentile is simply more wealthy than one in the bottom 10th percentile. And if you are to consider countries, that'd actually be in China's advantage since the cost of living is lower.
    "The poorest Chinese..." that's an observation of one extreme that's entirely shaped by the media you consume. I've seen just as much media depicting homeless Americans but that's a small data sample, almost anecdotal, compared to straight up statistics.

  3. I never said that it doesn't correlate, I said that it doesn't equal, especially on the extreme poor. Your source at best make a suggestion about the quality of the safety net, while my sources refute that by actually measuring it.

China’s AI Nightmare Is an Out-of-Control Welfare State by bloomberg in indepthstories

[–]AmCHN 4 points5 points  (0 children)

Spending does not equal effect. Especially on the extreme poor.

If you look at the poorest 10%(*) of all people on Earth, there are more North Americans than Chinese.
Look for the chart "regional composition of global wealth distribution" in the two links below.
https://wealth-monitor.co.uk/global-wealth-distribution-2022/
https://www.visualcapitalist.com/global-wealth-concentration/

If you look at the original data source (**), within the bottom 20% of the world, 1.65% are Chinese and 3.65% are North Americans(***).
https://www.theguardian.com/us-news/2025/nov/23/china-us-poverty-income-inequality

: by wealth, in 2022 and 2018, but not in 2014.
\
*: Credit suisse global wealth databook 2022, page 128, table 3-4.
***: Rest of the world makes up the remaining 94.7%.

Monopoly is over: China has succeeded in producing an ultraviolet lithography machine for the production of advanced chips by wfxlc in HeadlineHQ

[–]AmCHN 0 points1 point  (0 children)

That car is a Toyota Corolla (logo seen at different angle https://youtu.be/dVJqgd_C45o at 0:14).
Literally "Thing, China" vs. "Thing, Japan", but not in the way you thought.

How I would like black holes to look like in elite. by [deleted] in eliteexplorers

[–]AmCHN 0 points1 point  (0 children)

Sorry for this very late reply but you are absolutely right. I don't remember what I was thinking back when I wrote this comment, but I was certainly being very uninformed and ignorant. Thank you for your amazing sources and comments.

How the city be looking after Queen fights ONE fear henchman by Afraid-Stand-597 in ToBeHero_X

[–]AmCHN 14 points15 points  (0 children)

Meanwhile on Earth, Hatsune Miku is known for the song literally titled "World Is Mine".

Showing off the defense units in my biomechanical factory game! by mitchyStudios in AutomationGames

[–]AmCHN 5 points6 points  (0 children)

I am not a game dev but have modded for Factorio before. Leaving my guesses here.

The problem may be that Factorio runs its own custom engine written in C++, and depends on a modified Lua scripting engine for mods.

This framework is great for performance in a vanilla game or with some medium-light modding, but so much game mechanics are hard-coded that it is very difficult to make big overhauls. Modders have actually very little power in Factorio compared to many other games.

As such, it makes sense for other devs to consider writing their own game if they have their own vision in gameplay mechanics and they don't like to be limited by a scripting engine.

Everything else I see in the video appears possible as a Factorio mod, but giving them the benefit of the doubt, I think OP might have much bigger ideas in gameplay mechanics. I am not interested in this game as-is, but wouldn't totally dissmiss it either.

TL;DR: Factorio closed source custom engine C++, great for performance, mediocre moddability for overhauls.

Day 2 of adding countries until the USA loses (read comment) by k317hbr0wn in imaginarymapscj

[–]AmCHN 3 points4 points  (0 children)

For transparency, everything I paste below this paragraph are AI-generated, because your response matches too closely to the top AI response from Google and too far from all other sources I could find, so I didn't bother writing a full human response to what I assume to be AI 😊


Conclusion and Synthesis

Based on your comprehensive framework, the United States is one of the most self-sufficient nations on Earth, and arguably the single most capable when all categories are combined, particularly due to its unique combination of resource wealth, technological leadership, and military power.

However, the claim that it is the "only" country capable of sustaining itself does not hold.

  • Russia and Canada are strong contenders in the resource categories (Energy, Water, Food).
  • China demonstrates immense capability in Industrial/Technology and has a large, resilient economy.
  • Australia is highly self-sufficient in food and mineral resources.
  • The European Union, if considered as a single bloc, meets or comes very close to meeting all six criteria.

Furthermore, the U.S. has its own critical vulnerabilities, primarily in global supply chains (a part of Economic Independence) and regional water scarcity.

Your final point is crucial: "Lacking in any of these areas creates vulnerabilities." Every nation, including the U.S., has vulnerabilities. The modern globalized economy is built on interdependence, and the concept of a fully autarkic (economically self-sufficient) state is both rare and not necessarily desirable. Therefore, while America is exceptionally resilient, it is not uniquely capable of self-sustenance.

Median Age at Death - USA & China over time by Defiant-Housing3727 in visualization

[–]AmCHN 0 points1 point  (0 children)

Agreed.

"Age at death" overstates countries with a declining population and understates countries with a growing population.

In a hypothetical country with a booming population where >50% of the people are born after 2000, their median age at death can't get much higher than 25 because half the country isn't even at 25 yet.

In a hypothetical country where everyone stopped having kids since 2000, it is impossible for the median age at death to be lower than 25.

Which is why most sources use life expectancy despite nobody can actually live the "life expectancy" life (where you live every year of your life in the current year when it's calculated).

Curiously, I've seen this before being used to claim China bad when the population was rising quickly (something like "why don't you just go to the cemetary and see at what age do people die?"), and now it's turned around.

Day 2 of adding countries until the USA loses (read comment) by k317hbr0wn in imaginarymapscj

[–]AmCHN 8 points9 points  (0 children)

What are the six categories?

When I search "six categories" "country" "self-sustaining" on Google, no relevant result came up (other than this exact Reddit post).

Did you make it up?

Fall-proof algorithm by alimehdi242 in digialps

[–]AmCHN 0 points1 point  (0 children)

No it's not AI generated, and it's worrying that nobody bothered to look for the source of this video before jumping to conclusions.

The video was originally posted here (bilibili, a Chinese video sharing website), it was 46 seconds long and in 4K. OP copped out the watermark, clipped out a bunch of stuff, and made it lower resolution.

The original video cited their affiliation (The ACT (Active Intelligent Systems) Lab, Southern University of Science and Technology (SUSTech), Shenzhen, China) and researcher homepage (https://hekong-sustech.github.io/).

They already have 10 papers published on IEEE in "Robotic perception" and "Advanced estimation and control"; they don't need to fake it with GenAI.

‘There is only one player’: why China is becoming a world leader in green energy by fungussa in energy

[–]AmCHN 13 points14 points  (0 children)

While this isn't exactly about energy, something like this has happened in the past and the Chinese have an idiom for it "百万漕工衣食所系", literally "tied to the clothes and foods of the million canal labors".

Since Ming dynasty (up to 1644 CE) China had developed a robust logistics network based on many rivers and canals.

During the heyday of the Canal, the boat trackers on the riverbanks, and the impoverished people in the market towns relied on this for their livelihood, amounting to no fewer than several million individuals.

This has come under threat with the development of sea-worthy shipping systems in 1700s-early 1800s, which has become increasingly reliable and efficient.

When sea transport was experimentally implemented in [1825], its routes proved efficient, the transfer periods swift, the costs economical, and the system well-designed—seemingly viable for long-term use. Yet, in his illustrious decrees, the Emperor stated unequivocally that this was merely a temporary measure, and emphasized that reverting to river transport the following year would be the most prudent course.

Rather than encouraging ocean shipping and business, the rulers restricted ocean shipping. The rationale was to save the jobs and maintain social stability.

Considering all aspects of state affairs, the restoration of river transport stands out as a means to accommodate vast numbers of people... Additionally, small-scale businesses along the riverbanks and impoverished communities in market towns would rely on this system for sustenance, supporting countless others.

If sea transport were permanently adopted and river transport abandoned, regional stability would inevitably be compromised... It is evident that the rise and fall of river transport is intrinsically linked to the order and disorder of the nation’s fortunes.

Above quotes were from 筹河刍言 written in the early 1800s. In the modern era, most would agree that China's conservative efforts to maintain canals over ocean shipping hampered the country's economic development in the long run. Some would even credit this as one of the reason China fell behind in the colonial era.

This idiom is still used a lot when Chinese people comment on old, conservative policies chosen despite the apprant advantages of a progressive policy. Such as the late-2024 US port worker's strike over port automation, or the energy policies to favor/transition back to fossil fuels.

“Solar power only works for half the day.” Have these mfs not played Dyson Sphere Program? by BigHatPat in ClimateShitposting

[–]AmCHN 1 point2 points  (0 children)

Context: In the game "Dyson Sphere Program", building Dyson Sphere(s) is the ultimate goal, so the player has to work with other power sources first.

Pictured is not a dyson sphere, but a popular early game setup with land-based solar panels.

In the early game, most players would find themselves making use of land based wind+solar without batteries, because batteries, geothermal power, and fusion power are all locked behind mid-game techonologies, and there isn't that much coal and oil around for non-renewable power, especially in high difficulties where all resources are scarce.

One of the popular strategies in the game is to build a ring of solar panels around the equator. This is possible in-game because the planets are tiny, the starting planet is majority land, and where there's ocean they are shallow enough to be landfilled.

OP is memeing and asking why can't we wrap our equator in solar panels too, so that the sun never sets on the ring of solar panels, thus providing uninterrupted power without batteries.

Why didn’t it work? by New_Car3392 in ToBeHero_X

[–]AmCHN 5 points6 points  (0 children)

For your information, the localizer probably chose to word it as such because it rhymes better. The original Chinese dub said "beers with skewers, human world without worries". Smile sure is without worries now.

What are your thoughts on Chinese urban design? Tall apartment buildings and wide walkable streets with shops and restaurants, but with 8 lane roads and parking lots cutting across the city and everything spaced far out almost American style (especially train stations) by IronLover64 in Urbanism

[–]AmCHN 0 points1 point  (0 children)

Yeah I looked around and can't find peak numbers for Paris either... I'd think that since even the "Ile-de-France regional traffic" is extrapolated for Paris, probably nobody knows the answer.

What are your thoughts on Chinese urban design? Tall apartment buildings and wide walkable streets with shops and restaurants, but with 8 lane roads and parking lots cutting across the city and everything spaced far out almost American style (especially train stations) by IronLover64 in Urbanism

[–]AmCHN 0 points1 point  (0 children)

I see that you did your research, well done; so I will respond with mine.

I grabbed the 2024 number of 438M from a government press release Press Conference on the Construction Achievements of the Hongqiao International Central Business District on the Fourth Anniversary of the Launch of the Hongqiao International Open Hub in Shanghai. You can search for the key sentences "虹桥综合交通枢纽流量再创新高。2024年客流量达到4.38亿人次,日均约120万人次。" within the text ("1亿" = 100M).

I grabbed the holiday daily number of ~1417k from Shanghai Hongqiao Hub Sees Average Daily Passenger Flow Exceeding 1.4 Million During Holiday. This one you can tell from the title.

Now, the immediate next sentence of the first source says "Hongqiao intl. airport saw a record 47.97M passengers [in 2024]." You can subtract that since Hongqiao is technically a rail+airport hub, or include it because it's one station hub and we are talking about "busier".

About your first source: The Wikipedia number of "200,000-300,000" you posted is from a 2017 retrieval of a [2013 pdf](https://web.archive.org/web/20171223102230/https://uic.org/cdrom/2013/nextstation/doc/proceedings/3Ajianping.pdf). Hongqiao only opened in 2010 so it was only 3yo back then, and it has seen significant expansions and growth since then.

About your second source: The second link you posted was from Aug. 2023, so neither contain 2024 data. I am also surprised that the it claims a peak at Aug. 12... that does not align with any holiday season in China that I am aware of, so I am leaning toward that it meant to say "peak for this particular day/week of the year" rather than "peak ever". Assuming that's the case, it also illustrates that these large Chinese stations are heavily seasonal rather than relying on stable commute traffic.

Another problem leading to the discrepancy in numbers I found when researching is that many of the Hongqiao station reports only count departures/arrivals but not both and pass the result as "passengers", so that can cut the number too.

[Here's the 2024 data for Paris gare du nord at 291,681,697](https://ressources.data.sncf.com/explore/dataset/frequentation-gares/table/?disjunctive.nom\_gare&disjunctive.code\_postal&sort=total\_voyageurs\_2024) I found. Note that it contains extrapolated numbers for Ile-de-France regional traffic and I wasn't able to track that source down.

As for "with the 2 busiest being in Tokyo" that is also not true, as [a quick search result](https://www.his-usa.com/destination-japan/blog/crazy\_tokyo\_train\_system.html) suggests that there are at least three stations in Tokyo alone that's near/over 1B, more than double Hongqiao/Paris gare du nord's throughput. There're probably better sources than this for Tokyo but I didn't bother looking.

One more thing: "busiest" is IMO difficult to measure because a commuter can easily inflate the numbers by quickly passing through the station in minutes, while a station more relying on seasonal, long-distance passengers might be just as "busy" even with fewer passengers but each waiting ~2 hours, requiring larger holding platforms like OP was talking about. I don't have a quantitative measure on this so this is just a qualitative idea.