Announcement

Collapse
No announcement yet.

The Khronos Group's Vulkan, SPIR-V & OpenCL 2.1 Presentations

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

  • #31
    Originally posted by computerquip View Post
    As someone who prefers C, this is an absolute bologna and false statement.
    granted i don't know much cpp, so i may be wrong and there could be such a directive
    but how would you go about aligning your memory to 4k (or 16bytes) by using just cpp ?

    Comment


    • #32
      Originally posted by smitty3268 View Post
      In the video, someone in the audience complains that Vulkan is still a C API rather than C++ during the Q&A, i guess that's what he's referring to.

      The presenters pretty much blew him off and said everyone wanted a C api, and that if people wanted something in c++ it should be trivial for a library to wrap it around Vulkan.
      I'm surprised they didn't give any good reasons, while there are some. For example bindings from other languages are easier to make to C than to C++ because of the ABI complexity of the later. So for intance making bindings from Rust to Vulkan would be a straightforward work because Vulkan is C. With C++ it would have been a complex mess. So while I'd usually say C++ is better, for such core library which many languages would like to bind to, C actually serves better.

      Comment


      • #33
        Originally posted by gens View Post
        http://www.hxa.name/minilight/#comparison

        cpp does not give you absolute control over memory management, so it will never be as fast as C
        (and no, i don't count heavy hacks or using C as cpp)
        Originally posted by fromthelink
        C was faster than C++ probably mostly because LLVM's link-time optimisation worked for C, but not for C++.
        And using C of course counts, if you can compile it with a standard c++ compiler.

        Originally posted by gens View Post
        granted i don't know much cpp, so i may be wrong and there could be such a directive
        but how would you go about aligning your memory to 4k (or 16bytes) by using just cpp ?
        Not familiar with the subject, but wouldn't alignas do just that?

        Comment


        • #34
          Originally posted by erendorn View Post
          And using C of course counts, if you can compile it with a standard c++ compiler.

          Not familiar with the subject, but wouldn't alignas do just that?
          it doesn't count, if you ask me
          C and C++ are very very different
          more then that, some say that building cpp as a superset of C was its biggest mistake

          on the other point, i stand corrected
          took them only 32 years, but hey it's there


          PS
          there was a paper on C++ performance
          cba to find it now, but the conclusion was that it could reach C-s performance (but not in a way that any cpp programer would write code)
          Last edited by gens; 06 March 2015, 05:58 PM.

          Comment


          • #35
            Originally posted by gens View Post
            granted i don't know much cpp, so i may be wrong and there could be such a directive
            but how would you go about aligning your memory to 4k (or 16bytes) by using just cpp ?
            Same exact way you would in C. C++ has designated sizes for all of its types. Use of placement new eases using low-level memory allocators with C++ types. Although, I don't really see how this would make C++ slower anyways. Aligning memory can be slower than letting the memory allocator and compiler decide.

            Comment


            • #36
              Wow, it's actually scary hearing they were close to considering C++ for Vulkan.. now that would have been some train wreck.
              Also, well put by Sellers: "Object oriented design and C++ classes are orthogonal concepts".

              Comment


              • #37
                Originally posted by gens View Post
                http://www.hxa.name/minilight/#comparison

                cpp does not give you absolute control over memory management, so it will never be as fast as C
                (and no, i don't count heavy hacks or using C as cpp)
                Don't know what you've been smoking, but you have the same memory management capabilies in C++ that you do in C. You must be confused with C#. One of the gripes that C# and Java fans have about C++, is that the developer has to manage memory.

                quoted from your comparison:

                "C was faster than C++ probably mostly because LLVM's link-time optimisation worked for C, but not for C++."

                So a particular compilers optimizer worked with C code and not C++, doesn't add credibility to your argument. Gnu g++ will link-time optimize both C and C++.

                Comment


                • #38
                  Originally posted by gens View Post
                  it doesn't count, if you ask me
                  C and C++ are very very different
                  more then that, some say that building cpp as a superset of C was its biggest mistake

                  on the other point, i stand corrected
                  took them only 32 years, but hey it's there


                  PS
                  there was a paper on C++ performance
                  cba to find it now, but the conclusion was that it could reach C-s performance (but not in a way that any cpp programer would write code)
                  There is truth to that. In a nutshell you take advantage of the language extended features in performance non-critical code, and you focus your attention on performance where it counts.

                  Any one who has used a profiler knows that less than 10% of the code is affecting greater than 90% of the performance. It's almost always located in a few select functions.

                  Since good programmers can write C++ faster and more robustly than C code, that gives them more time to focus on that impact of that 10% of the code, and you may even have time even write it in assembly.

                  Once you go down the rabbit hole of thinking speed is always the ultimate goal you start writing everything in assembly.

                  Comment


                  • #39
                    Originally posted by shmerl View Post
                    I'm surprised they didn't give any good reasons, while there are some. For example bindings from other languages are easier to make to C than to C++ because of the ABI complexity of the later. So for intance making bindings from Rust to Vulkan would be a straightforward work because Vulkan is C. With C++ it would have been a complex mess. So while I'd usually say C++ is better, for such core library which many languages would like to bind to, C actually serves better.
                    they pointed that exact sentiment. i think it was Graham that said this when he also explained that while not C++ by default, they still use C objects like structure and C++ header is painless

                    Comment


                    • #40
                      Originally posted by shmerl View Post
                      I'm surprised they didn't give any good reasons, while there are some. For example bindings from other languages are easier to make to C than to C++ because of the ABI complexity of the later. So for intance making bindings from Rust to Vulkan would be a straightforward work because Vulkan is C. With C++ it would have been a complex mess. So while I'd usually say C++ is better, for such core library which many languages would like to bind to, C actually serves better.
                      Yeah, to clarify, they did say exactly that - in 1 sentence. Then they spent a minute or so talking about how there's nothing wrong with doing an object-oriented API in C. Then they had 1 sentence about how the vendors wanted something low-level and C seemed to fit that best.

                      Comment

                      Working...
                      X