Rust-Based, Memory-Safe PNG Decoders "Vastly Outperform" C-Based PNG Libraries

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Daktyl198
    Senior Member
    • Jul 2013
    • 1572

    #41
    Originally posted by Raka555 View Post
    Lets talk again in a few years when someone has to maintain this ...

    image.png
    There's no way you think that's unreadable. Do you program at all? I've written way worse stuff in JavaScript than that snippet.

    Comment

    • Daktyl198
      Senior Member
      • Jul 2013
      • 1572

      #42
      Originally posted by Raka555 View Post

      And this is also not complicated code, but it is written in APL

      image.png

      Same kind of readability issues ...
      Not to people who read/program in APL. You act like it's not Rust developers who will be maintaining a Rust crate.

      Comment

      • archfrog
        Junior Member
        • Feb 2024
        • 4

        #43
        Originally posted by amxfonseca View Post
        Observed result (aka reality):
        - Compiler produces faster code than superior elite developers.

        No one is surprised, modern compilers are that good! Combine that with a clean and modern language (doesn't even need to be Rust) and you have a killer combo.
        Wonderful! The better code the compilers generate (imagine when future AI is added to the process), the less work for the rest of us. I dislike Rust's syntax but I agree that Rust seem to have done many semantic things pretty well. And it is the semantic part of future languages that are going to enable compilers to optimize to such a degree that no human can compete.

        Oh, if only Rust didn't hurt my eyes every time I look at it, I would very much consider to pick up that language just to get to know the borrow checker and other semantic aspects of Rust.

        Imagine Rust with a fully typed, statically checkable, super-optimizable, compilable Python syntax! Oh, the wonders the world would see! :-)

        Comment

        • amxfonseca
          Phoronix Member
          • Sep 2019
          • 89

          #44
          Originally posted by sophisticles View Post
          What I would like to know is how much of this speed improvement is due to the programming language used and how much is due to the programming techniques being use.
          By writing an equally performant version in C. It is possible, but why would anyone bother with it?

          Originally posted by sophisticles View Post
          Here's my thinking, it could be that people that are using Rust are more aware of memory safe programming techniques than the programmers using C and so they employ more efficient algorithms, which in turn leads to better performance.
          Here is my thinking, it could be that people writing the code are aware of compiler optimisations and wrote it in a way that the compiler would auto vectorise it. This approach not only it produces faster code than the currently optimised libpng (although the SSE code was hand written in that case), it will also have higher chances of further performance gains due to future compiler improvements.

          Actually this is not my thinking, it is just the reality. You could reach the same conclusion if you bother to read the code of both implementations.

          And that is the real answer. Rust is more productive than C the same way C is more productive than assembly. It allows the developer to focus on his/her code, instead of memory management or complex error handling patterns. Why do something manually when a compiler can do it better?

          Give a Rust, C and Assembly developer the same amount of time to build the same piece of software, and the Rust developer will come up with better results than the C developer, the same way that the C developer will come up with better results compared to the Assembly developer.

          Comment

          • amxfonseca
            Phoronix Member
            • Sep 2019
            • 89

            #45
            Originally posted by archfrog View Post
            Oh, if only Rust didn't hurt my eyes every time I look at it, I would very much consider to pick up that language just to get to know the borrow checker and other semantic aspects of Rust.
            This is a valid argument, I can disagree with it but doesn't make me right or you any wrong. Matters of taste, and I have to respect that.

            I wish this whole Rust vs C discussion would sum to this. Instead of coming up with some random fabricated statements that can be proved wrong in less than 5 seconds.

            Comment

            • Steffo
              Senior Member
              • Jan 2013
              • 604

              #46
              Originally posted by sobrus View Post
              Usually pure C has very slight speed advantage anyway.
              This is simply not true. Because Rust makes strong safety-guarantees, the compiler can optimize more aggressively than in C. Further, developers tend more to parallelize more code, because of the safety-guarantees of Rust.

              Comment

              • brad0
                Senior Member
                • May 2012
                • 1009

                #47
                Originally posted by dlq84 View Post
                Where do you see them? All I see are people with rust derangement syndrome hating on the language. At least the posts before you.
                Most Rust threads are full of deranged loony toons Rust proponents. It's no wonder the have such a bad reputation.

                Comment

                • Steffo
                  Senior Member
                  • Jan 2013
                  • 604

                  #48
                  Originally posted by Raka555 View Post
                  Lets talk again in a few years when someone has to maintain this ...

                  image.png
                  Sorry, but this is peace of cake. Did you ever see C++ template meta-programming? I develop in C++ for a living and templates still causes me some headache. Also the undefined behaviour.
                  Last edited by Steffo; 09 December 2024, 03:57 PM.

                  Comment

                  • entropicdrifter
                    Junior Member
                    • Mar 2024
                    • 26

                    #49
                    Originally posted by brad0 View Post

                    Most Rust threads are full of deranged loony toons Rust proponents. It's no wonder the have such a bad reputation.
                    Genuinely hilarious comment to read given that any time Rust is mentioned on Phoronix in any context at all, people come out of the woodwork to complain about Rust and "Rust proponents" and throw around ridiculous bad-faith arguments and childish namecalling

                    Comment

                    • sophisticles
                      Senior Member
                      • Dec 2015
                      • 2580

                      #50
                      Originally posted by amxfonseca View Post
                      By writing an equally performant version in C. It is possible, but why would anyone bother with it?

                      Here is my thinking, it could be that people writing the code are aware of compiler optimisations and wrote it in a way that the compiler would auto vectorise it. This approach not only it produces faster code than the currently optimised libpng (although the SSE code was hand written in that case), it will also have higher chances of further performance gains due to future compiler improvements.

                      Actually this is not my thinking, it is just the reality. You could reach the same conclusion if you bother to read the code of both implementations.

                      And that is the real answer. Rust is more productive than C the same way C is more productive than assembly. It allows the developer to focus on his/her code, instead of memory management or complex error handling patterns. Why do something manually when a compiler can do it better?

                      Give a Rust, C and Assembly developer the same amount of time to build the same piece of software, and the Rust developer will come up with better results than the C developer, the same way that the C developer will come up with better results compared to the Assembly developer.
                      I can tell you are not a programmer, at least not an old school one when programmers weren't being churned out by the millions by these half-assed tech schools like DeVry.

                      There was a time programmers made extensive use of assembler and didn't rely on a compiler to auto vectorize a thing, they hand optimized their code.

                      Today you have people with the equivalent skill level of a high school kid writing code using generic algorithms hoping that some programmer more talented than them writes a compiler that will make them look like they know what they are doing.

                      Comment

                      Working...
                      X