“I’ve been thinking about this lately. Can you actually be faster than C? Like, in the sense that you can transpile any bit of Python or Lisp or Haskell or Rust or JS into C but the opposite isn’t necessarily true because not all those language support all the features exposed in C (such as goto, no bounds checking, pointer arithmetic, etc.), any algorithm…”
Inflationary Constant Factors and Why Python is Faster Than C++
Constant-factor differences are frequently ignored when analyzing the complexity of algorithms and implementations, as they appear to be insignificant in practice. In this paper, we demonstrate that this assumption can in fact have far more profound implications on time complexity than is obvious at first glance, and that a poor consideration of trade-offs can result in polynomially slower algorithms whose roots can be deeply and fundamentally ingrained into a programming language itself. While the general observation may not be novel from a theoretical standpoint, it is rarely (if ever) presented in traditional computer science curricula or other settings, and appears to be far from common knowledge in practical software engineering. We thus hope bring awareness to this issue and urge careful consideration of significant trade-offs that can result from trivial decisions made while programming.
候选层:至少 2 个不同的人、在 2 个不同月份提到过,还没到主书架的 3 人 3 个月。没有做立场标注,所以只写“被提及”。
HN 书评
没有评论直接链到它;下面是它被提交的讨论串里回复最多的评论(不计入统计)“If you're wondering whether this is a theoretical or practical problem: I actually observed some of this effect in practice first, and only after thinking about it for a while did the larger issue (and the complexity implications) dawn on me. I had something like a set<string> or a set<set<string>> (or map... I can't remember which) somewhere in my progr…”
“cpython is faster than c++ under the following circumstances: 1) when you're using native libraries via python that were written by better c/c++ programmers than you are and you're spending most of your time within them 2) when you're using native libraries in python that are better implementations than the c/c++ libraries you're comparing against 3) w…”
- Inflationary Constant Factors, and Why Python Is Faster Than C++ ↗mehrdadn · 2019-12-03 · 1 分
- Inflationary Constant Factors (and Why Python Is Faster Than C++) ↗mehrdadn · 2019-12-09 · 2 分
- Inflationary Constant FactorsAnd Why Python Is Faster Than C++ [PDF] ↗BerislavLopac · 2019-12-12 · 2 分
- Accidentally quadratic: When Python is faster than C++ ↗mehrdadn · 2021-03-04 · 218 分