Announcement

Collapse
No announcement yet.

Rewriting Old Solaris C Code In Python Yielded A 17x Performance Improvement

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

  • #71
    Originally posted by smitty3268 View Post

    -Os is generally terrible for performance compared with -O2, or -O3.
    Terrible is a strong phrasing. Worse is a better description. Not bad, is another.

    Comment


    • #72
      Originally posted by L_A_G View Post

      Considering compilers that only do C aren't really a thing anymore and pure C is mostly used in limited embedded systems (where Python obviously isn't an option) talking about C++ was implied.
      The issue is not the compilers, it is the projects. There's still a huge number of projects that are pure C (e.g., bash). In fact, the vast majority of Linux commands are written in pure C, not C++.

      You can use ldd to check whether a binary links to a C++ lib or not.
      Last edited by vladpetric; 21 October 2019, 12:31 PM.

      Comment


      • #73
        Originally posted by cynical View Post
        Lua didn't exactly get everything right either... *cough* 1-based indexing *cough*
        In a sequence you see:
        1234567890,
        You only need to look into your keyboard
        Lua has started as a scientific Language for mathematicians, they don't like the 0 indexing as primary by default..

        Actually 1-indexing start is a miss-conception... you can start in positions '-1000' if you want to, its a hash table..
        Code:
        mytable          = {}
        mytable[ -1000 ] = "Lua"
        mytable[ 0 ]     = "Lua"
        mytable[ "abc" ] = "Lua"
        Last edited by tuxd3v; 21 October 2019, 12:54 PM. Reason: indentation..

        Comment


        • #74
          Originally posted by cynical View Post
          They are, but that's not really meaningful to say. Their implementation is 2500 lines of C code (- some python specific stuff). It makes a lot more sense to use Python than to write your own implementation of sets in C...
          sane choice would be to replace your own implementation of sets in c with standard implementation of sets in c++. as a bonus point then you really replace c implementation with other language, not one c implementation with different c implementations

          Comment


          • #75
            Originally posted by tuxd3v View Post
            Actually 1-indexing start is a miss-conception... you can start in positions '-1000' if you want to, its a hash table..
            you can't, list interface has implicit keys and starts with 1

            Comment


            • #76
              Originally posted by vladpetric View Post
              The issue is not the compilers, it is the projects. There's still a huge number of projects that are pure C (e.g., bash). In fact, the vast majority of Linux commands are written in pure C, not C++.
              c++ was designed to allow mixing with c and gradual switch from c. unlike python

              Comment


              • #77
                Originally posted by pal666 View Post
                c++ was designed to allow mixing with c and gradual switch from c. unlike python
                True, but it's not really happening within the linux tools space. Again, use ldd to see what is c++.

                Comment


                • #78
                  Originally posted by vladpetric View Post
                  True, but it's not really happening within the linux tools space
                  aren't gdb and gcc within the linux tools space?
                  Originally posted by vladpetric View Post
                  Again, use ldd to see what is c++.
                  that way you can only see what is linked with c++ standard library
                  Code:
                  $ echo 'int main ( ) { }' | g++ -o a -x c++ - -Wl,--as-needed ; ldd a
                          linux-vdso.so.1 (0x00007ffc19beb000)
                          libc.so.6 => /lib64/libc.so.6 (0x00007f6ad214c000)
                          /lib64/ld-linux-x86-64.so.2 (0x00007f6ad2343000)

                  Comment


                  • #79
                    Originally posted by pal666 View Post
                    aren't gdb and gcc within the linux tools space?
                    that way you can only see what is linked with c++ standard library
                    Code:
                    $ echo 'int main ( ) { }' | g++ -o a -x c++ - -Wl,--as-needed ; ldd a
                    linux-vdso.so.1 (0x00007ffc19beb000)
                    libc.so.6 => /lib64/libc.so.6 (0x00007f6ad214c000)
                    /lib64/ld-linux-x86-64.so.2 (0x00007f6ad2343000)
                    What I'm suggesting is an approximation, yes. But most code is not linked with --as-needed (and also not statically linked, which can obscure libraries).

                    Yes, you're absolutely right that gdb and gcc contain c++ code. Most tools in /usr/bin and /bin are still pure C though.

                    I don't think we're disagreeing about much here. I would like more code to be migrated to C++. And as you said, it can be done somewhat incrementally.

                    Comment


                    • #80
                      Originally posted by pal666 View Post
                      you can't, list interface has implicit keys and starts with 1
                      Implicitly you start at 1, but nothing prevents you from starting in any other positions, or even with a string, because a table is a hash-table..

                      Comment

                      Working...
                      X