Announcement

Collapse
No announcement yet.

Initial Patches Wire In C++20 Coroutines For The GCC Compiler

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by pal666 View Post
    massive improvement from early java days is very low bar
    Fair point, but it really has come a long way. Using escape analysis to transform heap allocations into stack allocations is amazing. And it can do object allocation in less than 10 CPU instructions (deallocation is close to free), something that is not possible with C++ because it lacks a generational GC. I used to dislike Java, but it is truly impressive.

    Comment


    • #22
      Originally posted by cynical View Post

      Fair point, but it really has come a long way. Using escape analysis to transform heap allocations into stack allocations is amazing. And it can do object allocation in less than 10 CPU instructions (deallocation is close to free), something that is not possible with C++ because it lacks a generational GC. I used to dislike Java, but it is truly impressive.
      C++ can allocate objects on stack (amortized cost: 0 instructions), Clang can remove new/delete (and reuse memory or the stack, see N3664), and if you think deallocation is anything close to free, you have no idea how GC works. The work is shifted to finding the objects you can free/reuse, just because you cant measure it in a short loop doesn't mean elsewhere CPU cycles arent wasted, cold memory has to be brought in (whether you actually find anything useful or not), further allocations might happen during deallocation.
      If you ever wondered why a Java app you havent used in a while will totally bog down when you open it up again: Thats the GC running over the whole process space.

      Comment


      • #23
        Originally posted by computerquip View Post
        You can't just say "no it can't" and not provide any examples or reasons why "it can't". What can C++ do that Rust cannot?
        let's start with including c headers. and i still don't see answer for what java or c# can do that rust cannot

        Comment


        • #24
          Originally posted by pal666 View Post
          what criticism?
          language improves with every release
          i have no idea what unnamed people complained about
          it was never like that
          world is running on c++. including rust compiler

          rust isn't an alternative to c++, so it can't be better alternative. maybe rust is an alternative to java or c#
          Here is a list of quotes about C++.
          http://harmful.cat-v.org/software/c++/
          Linus Torvalds have his criticism on C++. RMS agrees that C++ sucks.

          The Rust compiler is written in Rust, not C++.
          Mozilla ported some of their C++ code to Rust, so for their use case it as an alternative to C++.
          I get the impression that Rust is on a lower level than both Java and C#, hence more of an alternative to C and C++ than to Java and C#.

          Comment


          • #25
            Originally posted by cynical View Post
            Using escape analysis to transform heap allocations into stack allocations is amazing. And it can do object allocation in less than 10 CPU instructions (deallocation is close to free), something that is not possible with C++ because it lacks a generational GC. I used to dislike Java, but it is truly impressive.
            c++ doesn't lack a gc. it doesn't require gc, but it can use gc(and gcc itself uses gc, jvm itself is c++ app which uses gc). and surely it can do object allocation even faster with proper allocator. there is no garbage collector without overhead. you either have huge runtime one, or huge memory one (or both). and c++ doesn't need garbage collector because it doesn't produce garbage
            Last edited by pal666; 19 November 2019, 10:48 AM.

            Comment


            • #26
              Originally posted by uid313 View Post
              Here is a list of quotes about C++.
              http://harmful.cat-v.org/software/c++/
              Linus Torvalds have his criticism on C++. RMS agrees that C++ sucks.
              that's appeal to (dubious) authority.
              torvalds is happy c++ programmer for many years, stop quoting his old clueless self
              Originally posted by uid313 View Post
              The Rust compiler is written in Rust, not C++.
              only frontend. rest is llvm which is written in c++. and somehow rust is not seen as alternative to c++ by rust's compiler authors
              Originally posted by uid313 View Post
              Mozilla ported some of their C++ code to Rust, so for their use case it as an alternative to C++.
              mozilla has javascript code in same app, so for their usecase it is an alternative to javascript. and mozilla is rust's parent organisation, we are skipping it in objective comparison. objectively for their usecase chromium devs do not see rust as an alternative to c++. basically nobody sees it that way except clueless rust zealots
              Originally posted by uid313 View Post
              I get the impression that Rust is on a lower level than both Java and C#, hence more of an alternative to C and C++ than to Java and C#.
              i get the impression that rust is on a higher level than c++, hence more of an alternative to java and c#
              Last edited by pal666; 19 November 2019, 10:49 AM.

              Comment


              • #27
                Originally posted by pal666 View Post
                only frontend. rest is llvm which is written in c++. and somehow rust is not seen as alternative to c++ by rust's compiler authors
                Of course, they just re-use LLVM instead of re-inventing that. It is really smart of them to just write a front-end for LLVM and let LLVM do what it does best. That way they save a lot of time, effort, resources and don't redundantly duplicate what LLVM does so well. Then they benefit from all improvements to LLVM.

                Originally posted by pal666 View Post
                i get the impression that rust is on a higher level than c++, hence more of an alternative to java and c#
                But both Java and C# runs upon virtual machines. Java runs on JVM and C# runs on the .NET CLR.
                Rust is closer to the metal, I think it compiles down to native code.
                The abstractions in Rust are zero-cost. My understanding is that at least some of the abstractions in C++ are not. So I guess that would make Rust lower level than both Java and C#, and at least on the same level as C++ and arguably on a lower level than C++.

                Comment


                • #28
                  Originally posted by uid313 View Post
                  Of course, they just re-use LLVM instead of re-inventing that.
                  why they didn't reuse firefox istead of reinventing parts of it?
                  Originally posted by uid313 View Post
                  It is really smart of them to just write a front-end for LLVM and let LLVM do what it does best. That way they save a lot of time, effort, resources and don't redundantly duplicate what LLVM does so well. Then they benefit from all improvements to LLVM.
                  lol, they could save a lot of time and effort by not wasting their time on rust at all
                  Originally posted by uid313 View Post
                  But both Java and C# runs upon virtual machines. Java runs on JVM and C# runs on the .NET CLR.
                  not really. gcj runs java without virtual machine and rust is built by llvm which is literally (low level) virtual machine
                  Originally posted by uid313 View Post
                  Rust is closer to the metal, I think it compiles down to native code.
                  rust is higher from the metal than c++. and both java and c# compile to native code. ever heard about google switching all androids to art?
                  Originally posted by uid313 View Post
                  The abstractions in Rust are zero-cost.
                  that's a lie.
                  Originally posted by uid313 View Post
                  My understanding is that at least some of the abstractions in C++ are not.
                  your understanding is wrong
                  Originally posted by uid313 View Post
                  So I guess that would make Rust lower level than both Java and C#, and at least on the same level as C++ and arguably on a lower level than C++.
                  your guess is wrong. example of garbage in - garbage out
                  Last edited by pal666; 19 November 2019, 11:26 AM.

                  Comment


                  • #29
                    Originally posted by pal666 View Post
                    why they didn't reuse firefox istead of reinventing parts of it?
                    They did reuse parts of Firefox but ported some CSS coding to Rust.

                    Originally posted by pal666 View Post
                    lol, they could save a lot of time and effort by not wasting their time on rust at all
                    But the performance of Firefox improved after porting some code to Rust.

                    Rust is suited to parallelism and avoids data races.
                    https://hacks.mozilla.org/2017/08/in...css-aka-stylo/

                    Rust also avoids whole types of bugs, and their style component was written in Rust from the start instead of C++ they would have 73.9% less security bugs. (source)

                    Originally posted by pal666 View Post
                    that's a lie.
                    your understanding is wrong
                    Well they claim zero-cost abstractions in their documentation.
                    https://doc.rust-lang.org/nightly/em...tractions.html

                    Comment


                    • #30
                      Originally posted by pal666 View Post
                      why they didn't reuse firefox istead of reinventing parts of it?
                      lol, they could save a lot of time and effort by not wasting their time on rust at all
                      not really. gcj runs java without virtual machine and rust is built by llvm which is literally (low level) virtual machine
                      rust is higher from the metal than c++. and both java and c# compile to native code. ever heard about google switching all androids to art?
                      that's a lie.
                      your understanding is wrong

                      your guess is wrong. example of garbage in - garbage out
                      ... this is a garbage dump of misinformation.
                      1. Firefox doesn't implement a generic library for transforming IR into different architectures. What does Firefox have to do with anything?
                      2. Subjective at best.
                      3. This is just plain ignorant. Java and C# are both built as a managed language and take advantage of the fact they're run in a VM. When you use things like gcj (which isn't even maintained anymore), you lose parts of the language since you can't do everything that Java does in a native environment. By this logic, C++ also doesn't need to target a bare-metal architecture, it can target whatever it wants. Rust is generally compiled into native object code which is then linked into an executable or static/shared library that's run using the native executable loader.
                      4/5. Rust abstractions are not guaranteed to be "zero-cost". Neither is C++. The standard for C++ generally doesn't dictate anything concerning overhead, only providing an interface that is potentially capable of less overhead. Implementations may certainly differ.
                      6. Rust code is generally run at the same level as C++, objectively. You can compile your own basic Rust application using rustc and see what it links against. You can debug and step through it with gdb to see what it does exactly. You can export functions in a library compiled completely using the Rust language and toolset and then have a C application link against that library at link time.

                      It's almost like you're *trying* to spread misinformation. Rust has issues but no good can come from just stating incorrect things.
                      Last edited by computerquip; 19 November 2019, 09:00 PM. Reason: Fix numbering

                      Comment

                      Working...
                      X