Talk:C (programming language): Difference between revisions

Content deleted Content added
 
(8 intermediate revisions by 4 users not shown)
Line 142:
::::::::I am aware of that. However, inefficient code can be written in any programming language. A good programming language enables and encourages efficient code. No language can prevent inefficient code. I was talking about the overall trend of inefficiency in all parts of software development, which I think that readers need to understand. [[User:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO]] ([[User talk:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|talk]]) 14:52, 30 August 2025 (UTC)
:::::::::{{tq|Therefore, there is no problem with me using a primary source}} - but [[WP:PRIMARY]] says, under policy: {{tqb|2. Any interpretation of primary source material requires a reliable secondary source for that interpretation.}}So we have a problem. [[User:Sirfurboy|Sirfurboy🏄]] ([[User talk:Sirfurboy|talk]]) 22:23, 30 August 2025 (UTC)
::::::::::No, since there is no interpretation in my most recent edit, there is no problem. [[User:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO]] ([[User talk:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|talk]]) 22:43, 30 August 2025 (UTC)
:::::::Your suboptimal username is immediately fixable. Fixing it does not prevent you from participating here. [[WP:Battleground|Wikipedia is not a battleground]]; nobody here is out here to get you, even if some of us have overly concise language that might seem insulting and commanding. We just think it's far more efficient collaborating if we can envision the human behind a username, which no offense, your username makes hard to do. [[User:Aaron Liu|<span class="skin-invert" style="color:#0645ad">Aaron Liu</span>]] ([[User talk:Aaron Liu#top|talk]]) 14:57, 30 August 2025 (UTC)
::::::::"Your suboptimal username is immediately fixable."
Line 186 ⟶ 187:
::::::::::The research paper clearly supports a massive difference in the efficiencies of the implementations. [[User:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO]] ([[User talk:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|talk]]) 21:50, 30 August 2025 (UTC)
:::::::::::Why are we talking about Python at all? That is your fixation. That paper is specifically a study looking at fully 27 programming languages. It is not a study of C against Python - that is your interpretation of their data. It is not found in their conclusions. What the paper concludes is that a faster language is usually but not always more energy efficient. It is not speaking to a specific comparison of Python and C, and we ''cannot'' use their numbers to say in wikivoice that python {{tq|uses 75.88 times more electricity}}. Again, this is not encyclopaedic writing and it should not be in the article. <small>I mean, come on, 75.88? Only two decimal places?</small> [[User:Sirfurboy|Sirfurboy🏄]] ([[User talk:Sirfurboy|talk]]) 22:31, 30 August 2025 (UTC)
::::::::::::"That paper is specifically a study looking at fully 27 programming languages. It is not a study of C against Python."
::::::::::::If you really want to include all of the information about all of the other 25 programming languages that lose to C, then we can do so. Personally, I do not think that there is space in the article to add a section about each and every language that C is better than. If readers want all of those details, then they can read the paper themselves. It is a very good paper, and perhaps it should be an external link.
::::::::::::"It is not found in their conclusions."
::::::::::::Look at table 4. You are wrong. Also, look at table 13.
::::::::::::"75.88? Only two decimal places?"
::::::::::::Data Table 4 had two decimal places.
::::::::::::"we cannot use their numbers to say in wikivoice that python uses 75.88 times more electricity"
::::::::::::That is a straw man argument. My most recent edit was saying that the study found 75.88 times more electricity used in their benchmarks. [[User:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO]] ([[User talk:Lxvgu5petXUJZmqXsVUn2FV8aZyqwKnO|talk]]) 22:41, 30 August 2025 (UTC)
:::::::::::::Table 4 is results, not conclusions. What you are not getting here is that you have started with the conclusion that ''you'' want in the article (that C uses one 75.88th of the electricity of Python), and you are reading this primary source in such a way that it supports our tertiary encyclopaedic article in making the claim. Yes, that is a result line in table 4 of the paper. But that is not what the paper is about, and so prominently making this claim in our article is simply undue. What secondary sources are talking about C in terms of ''energy efficiency''? What do they say?{{pb}}You hit the nail on the head when you say {{tq|Personally, I do not think that there is space in the article to add a section about each and every language that C is better than.}} You are right. Or almost right. The article has lots of space, but what you can clearly see is that if we write up about all 26 other languages covered in that article, then this article would no longer be about C but would be what that paper is about - a comparison of 27 languages for energy efficiency. Wikipedia articles need to be focussed on their subject. The subject is C, not Python nor any other language. How would you write about C's energy efficiency (or just efficiency) without mentioning any other language by name at all? That is the <s>droid</s> edit you are looking for. [[User:Sirfurboy|Sirfurboy🏄]] ([[User talk:Sirfurboy|talk]]) 08:07, 31 August 2025 (UTC)
:::::::::::Fine by me. Probably just add it to the section I mentioned, though. I don't see much that'd be wrong with {{tq|Certain typically-written Python benchmarks to use 75.88 times more electricity on average than the corresponding C benchmarks, while taking an average of 71.9 times more time to complete than the C benchmarks. On average, the Python benchmarks had a peak RAM usage that was 2.39 times more than the C benchmarks.[refs]}} plus a mention of what implementations were used and maybe plus some of the other compiled languages. Don't make it too long, though. [[User:Aaron Liu|<span class="skin-invert" style="color:#0645ad">Aaron Liu</span>]] ([[User talk:Aaron Liu#top|talk]]) 22:58, 30 August 2025 (UTC)
::::::::::::Apologies to @[[User:CycleSortSupreme|CycleSortSupreme]] (formerly known as Lxvg...), but I've deleted the section they created on Efficiency. This discussion has not yet reached consensus. A section (before Hello World, even) is in my opinion be [[WP:UNDUE]].
::::::::::::Perhaps a few words like {{tq|The machine code compiled from programmes written in the C language leads to execution that is hugely more efficient than running interpreted, byte-coded or JITed languages. A like-for-like study found C coded samples to be around 70 times more energy- and CPU efficient than those written in Python, and the C code used less than half the RAM.}} [[User:Chumpih|<span style="text-shadow: 2px 2.5px 3px #448811bb">Chumpih</span>]] <sup>[[User talk:Chumpih|t]]</sup> 06:48, 31 August 2025 (UTC)
:::::::::::::I think any form of words should omit Python or any other language by name. C is efficient for lots of reasons, like optimised compilers that create native machine code, static typing, efficient memory management <small>although actually the garbage collection issue is a bit more nuanced than many suppose</small> etc. However we can say all that without referring to any other language. An article on C just has to explain that one reason for writing in C is it creates efficient and fast code (which also makes it low energy). [[User:Sirfurboy|Sirfurboy🏄]] ([[User talk:Sirfurboy|talk]]) 08:19, 31 August 2025 (UTC)
::::::::::::::Unsure why Python, the currently most popular language,<ref>{{cite web|title=TIOBE Index |url=https://www.tiobe.com/tiobe-index/}}</ref> should be omitted. I don't see an issue with comparisons, especially when they're reasonably sourced. But that said, mine is not a strong stance. What words should go in? And where? [[User:Chumpih|<span style="text-shadow: 2px 2.5px 3px #448811bb">Chumpih</span>]] <sup>[[User talk:Chumpih|t]]</sup> 18:44, 31 August 2025 (UTC)
::::::::::::::I suppose that explaining the reasons for which C implementations are more efficient is okay; however, I am not sure where to find sources for those claims that people will accept as "reliable".
::::::::::::::I know that as a rule of thumb, unoptimizing compilers tend to be approximately 9 times faster unoptimizing interpreters; however, I have no "reliable" source for that claim.
::::::::::::::I know that static typing, manual memory management, second class arrays, fixed width integers, undefined behavior, pointers and pointer arithmetic, and various other features contribute to C having a low overhead. However, I am not sure what "reliable" source to cite for those claims.
::::::::::::::I put the word "reliable" in quotes because I disagree with Wikipedia as to what sources are reliable. Personally, I think that arXiv, Stack Overflow, and Stack Exchange are typically reliable; however, it seems that Wikipedia does not agree. [[User:CycleSortSupreme|CycleSortSupreme]] ([[User talk:CycleSortSupreme|talk]]) 04:45, 1 September 2025 (UTC)
:::::::::::::::Look in a textbook. Here's something I found right away, but there will be more and with more detail: {{tqb|Despite being insecure by nature, C programs run fast. Very fast. In fact, most of the “high- performance” libraries used by Python are actually written in C, then lightly wrapped with a tiny bit of Python code. The software in higher-level languages that run “on top” of C provides the security, flexibility, and convenience that C lacks. This makes sense: complex systems are built in layers. (Toal et al., 2024:267)}}
:::::::::::::::* Toal, R., Strieker, S. & Berardini, M. (2024) ''Programming Language Explorations'' Boca Raton, London & New York:CRC Press
:::::::::::::::Interesting that this one does mention Python, as an example of how language libraries may be optimised by writing in C. [[User:Sirfurboy|Sirfurboy🏄]] ([[User talk:Sirfurboy|talk]]) 08:08, 1 September 2025 (UTC)
::::::::"developers have had way longer time to optimize (compiled) C implementations"
::::::::C is approximately 1.53 times older than Python. Python is 34 years old. C is 52 years old.