• Re: "Python is 71x Slower, Uses 75x More Energy, Than C" - YouTube

    From Bart@21:1/5 to Lynn McGuire on Wed Jul 31 12:15:58 2024
    On 31/07/2024 01:06, Lynn McGuire wrote:
    "Python is 71x Slower, Uses 75x More Energy, Than C" - YouTube
       https://www.youtube.com/watch?v=U4c6nFGt1iM

    Could that guy's voice be any more annoying?

    Anyway, some observations:

    * CPython (I assume this is Cpython), is of course just a program
    written in C. So it's really just a C application ...

    * The C results are going to be mostly thanks to the efforts of
    aggressively optimising compilers, rather than the language itself. I
    guess they weren't using Tiny C!

    * The test programs are all from the computer language benchmarks game,
    which are mostly useless for comparisons. Because entries can choose
    their own algorithms, employ multi-threading etc. So it's no surprise
    there is such a wide range of results.

    * When Python is used for a one-off program that runs in a fraction of a second, the fact that is is 70 times slower than the C equivalent is irrelevant. But if you include the build-time for the C, then the Python
    may well have used fewer machine resources.


    I am not buying that C++ is slower than Rust.

    The referenced paper is:
       https://www.sciencedirect.com/science/article/abs/pii/S0167642321000022


    It's the computer benchmarks game; I wouldn't pay too much attention.

    When I once tested of its programs ('fannkuch') I got these results,
    although they are several years old (3 out of 24 shown):

    Clang -O3 2.45 secs
    Rustc -O 3.2
    Tiny C 10.1
    Rustc 37.8

    Rust in debug mode ran a magnitude slower than optimised releae mode.
    Maybe it was interpreted? I never found out why.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Kuyper@21:1/5 to jseigh on Fri Aug 2 14:59:01 2024
    On 7/31/24 08:13, jseigh wrote:
    On 7/30/2024 8:05 PM, Lynn McGuire wrote:
    "Python is 71x Slower, Uses 75x More Energy, Than C" - YouTube
       https://www.youtube.com/watch?v=U4c6nFGt1iM

    I don't know for sure but I suspect part of it is Python using
    reference counting for it's memory managment. Maybe they should
    compare it to jython.

    I am not buying that C++ is slower than Rust.

    Rustaceans make a lot of unsupported claims. They also claim without
    any support that java is slower than rust. Apparently they are
    completely ignorant of the fact that java uses JIT compilation and can dynamically tune performance hot spots, and if they are using
    reference counting to manage memory it's going to perform very badly
    compared to Java GC.

    Keep in mind that this is not an "unsupported claim" - it's the result
    of measurements, with the method used to make the measurements
    specified, though not completely. I hove no idea how, but you should be
    able to ask the author of the paper to send you copies of the source
    code used, and details of the compilation options chosen. In this kind
    of academic study, providing such details on request is considered
    mandatory.

    In order to counter such evidence, you should ideally try to repeat the
    tests. You might find that they are biased in some way. For instance,
    the Rush versions of the programs might have been written by an expert,
    while the C++ versions might have been written by someone who hates C++, Alternatively, you might find that the particular algorithms chosen
    create a bias towards Rust over C++. But you can't simply dismiss this
    as due to the author of that study being a Rust fanboy - the study
    covers many different languages, and if anything suggests that C vs.
    Python is his main interest.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to James Kuyper on Fri Aug 2 23:59:19 2024
    On Fri, 2 Aug 2024 14:59:01 -0400, James Kuyper wrote:

    On 7/31/24 08:13, jseigh wrote:

    ... and if they are using
    reference counting to manage memory it's going to perform very badly
    compared to Java GC.

    Keep in mind that this is not an "unsupported claim" - it's the result
    of measurements ...

    Yeah, I wonder why Java fan(atic)s keep spouting that nonsense. Other
    languages (Perl, Python) have shown the benefits of having reference
    counting as a first resort, only falling back to garbage collection to
    handle those (less frequent) cases where it is needed.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to Lynn McGuire on Fri Aug 2 20:48:54 2024
    On Tue, 7/30/2024 8:06 PM, Lynn McGuire wrote:
    "Python is 71x Slower, Uses 75x More Energy, Than C" - YouTube
       https://www.youtube.com/watch?v=U4c6nFGt1iM

    I am not buying that C++ is slower than Rust.

    The referenced paper is:
       https://www.sciencedirect.com/science/article/abs/pii/S0167642321000022

    Lynn

    https://www.reddit.com/r/rust/comments/lb2aeu/ranking_programming_languages_by_energy_efficiency/

    "Tests are garbage, they use an Intel i5-4460 with AVX2 but let focus on mandelbrot test

    -Rust is compiled with: -O3 and targeting a CPU compatibility of Core2

    -C is compiled with: -O3, cpu as native and vectorial support

    code and compile options can be checked at
    https://github.com/greensoftwarelab/Energy-Languages

    "

    *******

    "A better link imho:

    https://sites.google.com/view/energy-efficiency-languages

    https://sites.google.com/view/energy-efficiency-languages/setup

    Benchmark # images extracted with snippingtool and text-actions
    n-body # then spreadsheet, export pdf, pdftotext -layout some.pdf some.txt
    fannkuch-redux
    spectral-norm
    mandelbrot <=== "focus on mandelbrot test"
    pidigits
    regex-redux

    fasta
    k-nucleotide
    reverse-complement
    binary-trees
    chameneos-redux
    meteor-contest
    thread-ring

    Version Version
    Ada GNAT 6.2.0 Jruby jruby 9.1.7.0
    C gcc 6.2.0 Lisp SBCL 1.3.3.debian
    C# dotnet 1.0.1 Lua Lua 5.3.3
    C++ g++ 6.2.0 Ocaml ocamlopt 4.05.0
    Chapel chpl 1.15.0 Pascal fpc 3.0.2
    Dart Dart VM 1.24.0-dev.0.0 Perl perl 5.24.0
    Erlang Erlang 7.3.1.2 PHP php 7.1.4
    F# dotnet 1.0.1 Python python 3.5.2
    Fortran ifort 17.0.3 Racket raco 6.8
    Go go go1.6.3 Ruby ruby 2.4.1
    Hack HipHop VM 3.19.2 Rust ruste 1.16.0
    Haskell ghc 8.0.2 Swift swift 4.0-dev
    Java jdk 1.8.0_121 TypeScript node 7.9.0
    JavaScript node 7.9.0
    "

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)