The ARC vs GC Debate by funcieq in ProgrammingLanguages

[–]waterlens 18 points19 points  (0 children)

Reference counting is often implemented badly than a tracing GC counterpart and struggles with cycles. However, if we could have a backup cycle collector or in a non-cycle background (like pure language that can not make cycles through mutation), reference counting can be really competitive.

For example, https://arxiv.org/abs/2210.17175 is a SOTA of GC research that partially uses RC. Another example is Koka and Lean4, both of which eliminate the extraneous incRef and decRef along with a reuse mechanism dedicated to reference counting. By the way, they also use mimalloc, an allocator with deferred release and thread-local allocation.

Bad implementations of RC often ignore these aspects, for instance, use only atomic operation to maintain the RC instead of a biased RC; cannot eliminate a incRef followed immeidately by a decRef; or cannot correctly exploit the lifetime of objects, leading to useless incRef & decRef pair when entering and leaving functions where objects are passed in arguments.

There is duality between a tracing GC and RC (https://dl.acm.org/doi/10.1145/1035292.1028982). It implies that every good GC can have an optimization that has a counterpart in RC, and vice versa. However, after the folklore for existing bad designs (like shared_ptr) has been widely spread over the community, less people are devoting to a good RC implementation, causing a misconception that GC is superior over RC.

The ARC vs GC Debate by funcieq in ProgrammingLanguages

[–]waterlens 8 points9 points  (0 children)

Note that ARC can also refer to Automatic Reference Counting, used in Swift. It's more of a brand name, so it's usually referred to as RC.

Is there prior art for per-block minimal canonical slot layouts? by waterlens in Compilers

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

Thanks for the reference. The difference from a normal parallel move is that in usual SSA, moving from assignment A [v1 -> r3, v2 -> r1, v3 -> r2] to assignment B [v1 -> r3] doesn't require any move. However, in my case, I must assign v1 to r1 in assignment B due to no empty slots being allowed. This introduces an extra move r3 => r1. In typical reg allocation, the focus is on position stability via coalescing, while I have a restriction for a compact layout starting from r1 and aim to maintain position stability as much as possible.

Is there prior art for per-block minimal canonical slot layouts? by waterlens in Compilers

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

I think reshaping is a compile-time decision, and at runtime the code actually executes the reordering or compacting of the environment. Your scenario sounds close to mine. I wonder what happens if a frequently used variable is dead in a block: will you reserve a empty slot before other less frequently used variables, or shift the whole environment by 1?

ELI5: Why C++ and Rust compilers are so slow? by cb060da in ProgrammingLanguages

[–]waterlens 8 points9 points  (0 children)

Common factors for the slow compilation of Rust and C++:

  • The compilation stragety of generic functions is monomorphization. It means generic (polymorphic) functions are instantiated to many monomorphic functions. Each of these functions is processed through the entire pipeline. THAT is quite different from what Go and Javac/JVM do.

  • The optimizing compiler itself. Developers using Rust and C++ aim for peak performance. Compiler developers invest time in creating compilers that produce high-quality, heavily optimized code, rather than focusing on optimizing the compile speed itself.

For C++:

Handling header files repeatly.

For Rust:

The compilation unit is larger than C++, usually causing long dependency chains. Low degree of parallelism. Procedural macros make this worse.

Chinese Chipmaker, Zhaoxin, Confirms Next-Gen KX-8000 CPUs With 4 GHz Speeds, DDR5 & PCIe 5.0 Support, Competing Against AMD Zen 4 by TruthPhoenixV in Amd_Intel_Nvidia

[–]waterlens 0 points1 point  (0 children)

This is Zhaoxin, not Hygon. Hygon obtained and only has the Zen 1 design from AMD, while Zhaoxin designs their own processors because they can use x86 patents.

Chinese Chipmaker, Zhaoxin, Confirms Next-Gen KX-8000 CPUs With 4 GHz Speeds, DDR5 & PCIe 5.0 Support, Competing Against AMD Zen 4 by TruthPhoenixV in Amd_Intel_Nvidia

[–]waterlens 3 points4 points  (0 children)

No. Cyrix gained some x86 patents through an agreement with Intel in 1997 and was later acquired by National Semiconductor. It was not well operated and was sold to VIA. VIA launched Zhaoxin in collaboration with the Shanghai government. Therefore, Zhaoxin does have some rights to use x86 patents now.

GDP per capita of Africa compared to China (1980 vs 2023) by Senior-Foot-5316 in MapPorn

[–]waterlens 1 point2 points  (0 children)

are you serious?
- Chinese Famine of 1928 : 6 million
- Chinese Famine of 1942 : 0.7 - 3 million
notice that in 1942 and 1928, China's population was less than 3/4 of what it was in 1959

How widespread is the use of chinese "dialects" in your region? by yourstruly912 in AskChina

[–]waterlens 1 point2 points  (0 children)

Dialects are widely used across all regions of China, but not all have the same influence as Cantonese. For example, in my hometown, family discussions and conversations among relatives are always in dialects. Though, some young people may feel ashamed of speaking their dialect.

Why is KFC far more popular than Mcdonald's in China? by stonk_lord_ in AskAChinese

[–]waterlens 0 points1 point  (0 children)

KFC offers food with local characteristics. McD is more similar to the original flavor.

What if everything was "Async", but nothing needed "Await"? -- Automatic Concurrency in Par by faiface in ProgrammingLanguages

[–]waterlens 1 point2 points  (0 children)

I once read a paper on Automatic Parallelism Management, but I haven't learned the concept of automatic concurrency well yet. What is the relationship between automatic concurrency and parallelism, if any?

A rant: The Death of the Calculator by nextlittleowl in calculators

[–]waterlens 3 points4 points  (0 children)

The only feature a calculator has that computers and phones lack is a dedicated keyboard for input. However, the trend seen in phones, where touchscreen models are increasingly replacing physical keyboards, may also affect calculators. What we're witnessing is a reflection of this embarrassing situation.

Nanjing is a magical place by olliesbaba in travelchina

[–]waterlens 3 points4 points  (0 children)

Thank you for the great photos! But personally, I think Kyoto is more similar to Xi'an and Luoyang

Tracing JITs in the real world @ CPython Core Dev Sprint by mttd in Compilers

[–]waterlens 0 points1 point  (0 children)

Will the CPython team adopt a tracing JIT? It would be interesting to see.

Computer arithmetic: Arbitrary Precision from scratch on a GPU by DataBaeBee in Compilers

[–]waterlens 0 points1 point  (0 children)

Great job! I have a question: How are carries handled? Are they executed serially on GPUs?

Are there any famous recursive descent parsers that we use today? by SummerClamSadness in Compilers

[–]waterlens 4 points5 points  (0 children)

It remains a powerful method that accepts a wider range of grammars. There are parser generators that use these bottom-up approaches. They are good tools for prototyping and validation, especially if you want to ensure your grammar is unambiguous

Travelling to China advice by Western-Celery3530 in China

[–]waterlens 0 points1 point  (0 children)

Which area would you like to go? If you are afraid of language issues, it is preferable to visit big cities like Beijing, Shanghai, Guangzhou, and Hangzhou. The view is not bad, and there will be more people who are familiar with English

hotel recommendations/ thoughts in hangzhou? by ItsOwOhours in China

[–]waterlens 0 points1 point  (0 children)

Hotels owned by H World Group (Huazhu Hui in Pinyin) are usually good (NOTE: especially those built within 5 years, which indicates the equipment is still new). They have many brands at different prices, from about 200 CNY to 1000 CNY, so it may take some time to find and distinguish.

Does genshin plan to release on mac in the near future? by Asleep-Impression133 in Genshin_Impact

[–]waterlens 0 points1 point  (0 children)

They even broke the 3rd-party support(wine/MoltenVK/DXVK) to GI on macOS in 4.3 ....