Announcement

Collapse
No announcement yet.

Unity Is Growing Their LLVM Compiler Team As They Try To Make C# Faster Than C++

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

  • #11
    Originally posted by kpedersen View Post

    Yep. Even C++. UE4 for example is C++ and garbage collected. Not the typical Boehm's GC but a home grown one.

    That said, C++ is *not* manual memory management. RAII in many ways is faster and safer than garbage collection.
    RAII isn't built into C++, it is a technique invented for C++, and a technique possible in C++ because C++ has manual memory management, thereby allowing programmers to write new innovative ways of managing their memory, since it is always under their control.

    Comment


    • #12
      Originally posted by atomsymbol

      Neither of the approaches provides help if (because of a bug in the program) the programmer forgets to explicitly set certain variables to nil/null/nullptr or forgets
      I agree if writing lower level bindings i.e with a C program but if going for safety rather than speed (which should be more often than not), you will be using variable types that do not need setting to null. The C++ example is weak_ptr.
      Also debug time safety measures like ElecricFence or debug STL means that you can test for these kinds of issues more consistently than a GC.

      This extra ability to verify code at debug time is why I think RAII can be a safer strategy than GC.
      Last edited by kpedersen; 07 April 2019, 03:37 PM.

      Comment


      • #13
        Originally posted by carewolf View Post

        RAII isn't built into C++, it is a technique invented for C++
        That could very well be the case. I wasn't really looking at the history of the technique. That said, RAII is also very evident in a lot of Ada code so I wouldn't suggest that it is primarily a C++ feature. Just like a garbage collector isn't primarily a Java or .NET feature.

        However I disagree that C++ is a manual memory management language. As soon as they added exceptions to the standard, it no longer could be. Yes, I have seen people attempt with new and delete, and try catches everywhere but it is basically defective.
        I have seen the same attempts with C setjmp and longjmp, it rarely ends well.

        Likewise I could disable the garbage collector in Java... That doesn't make Java a manual memory management language.


        Originally posted by caligula View Post
        You're also confusing RAII, which is a C++ term, with automatic memory management in general. Not all automatic resource management schemes are tied to stack like in C++.
        No I was specifically referring to RAII because it is the main contester against garbage collection in the game engine world.
        Again, RAII may well have started out with just C++ but its use has propagated outside this language.
        Ada and Rust are the obvious examples.
        Last edited by kpedersen; 07 April 2019, 03:39 PM.

        Comment


        • #14
          Originally posted by kpedersen View Post

          That could very well be the case. I wasn't really looking at the history of the technique. That said, RAII is also very evident in a lot of Ada code so I wouldn't suggest that it is primarily a C++ feature. Just like a garbage collector isn't primarily a Java or .NET feature.
          Right. It might be a question of terminology. RAII is the name of a C++ technique that can do things such as exception safe mutex locking, but also reference counted memory managment, but many other languages also has reference counted memory management, many predating RAII or even C++. Some C++ inspired langauges also has RAII techniques, and many more programming languages has other mechanisms or patterns that can achieve something similar to RAII, but the techniques usually have different names in other languages if the technique there isn't based around customizable object constructors and destructors.

          I am not familiar with Ada, but isn't that an old language? Do you mean it has reference counting garbage collection, or does it have constructors and destructors like C++ and thus can do RAII unaltered?

          Originally posted by kpedersen View Post
          Again, RAII may have started out with just C++ but its use has propagated outside this language.
          Ada and Rust are the obvious examples.
          I agree

          Comment


          • #15
            An explanation of why you should favor procedural programming over Object-Oriented Programming (OOP).


            Some of you guys need to watch this. It is directly related.

            You guys have attempted to use an android device at some point in your life right?

            Comment


            • #16
              Originally posted by duby229 View Post
              https://www.youtube.com/watch?v=QM1iUe6IofM

              Some of you guys need to watch this. It is directly related.

              You guys have attempted to use an android device at some point in your life right?
              A 45 min Youtube video from some self-entitled prick and "hurr durr Android" is all you have? "THE MOST IMPORTANT PROGRAMMING VIDEO YOU WILL EVER WATCH"? Get outta here, ever heard of books?

              Sorry, doesn't really add to the quality of the discussion.

              Comment


              • #17
                It's a pity that D never really took off because IMHO it's a better language than both C++ and C#.

                Comment


                • #18
                  Originally posted by kpedersen View Post
                  That could very well be the case. I wasn't really looking at the history of the technique. That said, RAII is also very evident in a lot of Ada code so I wouldn't suggest that it is primarily a C++ feature. Just like a garbage collector isn't primarily a Java or .NET feature.
                  You're screwing around with the terminology. There is a more general concept at play here. RAII is C++'s implementation of the feature. For instance, the definition of RAII expects classes and constructors/destructors. It doesn't even apply to Java. It is scientifically incorrect to refer to the concept as RAII. There's only a single Wikipedia article pushing RAII as the name of the concept, and that article has a banner warning about its quality issues.

                  No I was specifically referring to RAII because it is the main contester against garbage collection in the game engine world.
                  Again, RAII may well have started out with just C++ but its use has propagated outside this language.
                  Ada and Rust are the obvious examples.
                  Wrong. Ada predates C++ and Rust's borrow checker is something totally different. C++'s RAII is strictly tied to static scope/stack. Rust has a lot more flexible system. Girard's linear logic also covers the same problem space. He was designing the complete logic model before C++ was even published.

                  Comment


                  • #19
                    Originally posted by ypnos View Post

                    A 45 min Youtube video from some self-entitled prick and "hurr durr Android" is all you have? "THE MOST IMPORTANT PROGRAMMING VIDEO YOU WILL EVER WATCH"? Get outta here, ever heard of books?

                    Sorry, doesn't really add to the quality of the discussion.
                    Of course, you could actually take a look at -any- code..... But that's probably way beyond you.....

                    Comment


                    • #20
                      So, taking a brief look at the slides that Michael linked to, this seems to involve:

                      1. Getting rid of garbage collection
                      2. Running a bunch of optimizations that can be run when there is no memory aliasing
                      3. Adding SIMD intrinsics
                      4. A bunch of optimizations to the Unity math library, and things like options to tell the compiler to use low-precision math on functions, etc.
                      5. probably some other stuff...

                      And it's all based on having a safe-subset of c# that this stuff applies to. Use the full language and it falls back to the regular compiler.

                      Comment

                      Working...
                      X