44 bình luận về “[Tin tức] programming language, speed compilation #c++ #golang #rust”

  1. Compilation speed obviously largely depends on hardware, and size of the project. I read below a comment that a 30MB project took about an hour to build. Considering it took me less than that to build the ENTIRE llvm github repo, that sounds mostly like a low end hardware problem (mind you my current hardware is like 8 years old and wasn't that special even then). That also largely has a lot to do with make/cmake, imo. I have noticed in some instances, where it isn't too much to just compile with gcc/clang manually, compile times are actually a little faster, since you don't have another abstraction from the compiler itself.

    That brings me to another point, the compiler choice. That can also play a big role in compile times. In my experience so far, clang tends to be a tiny bit faster than gcc, but only after caches are loaded up. It's never by much, though I haven't personally worked on any real large C/C++ projects so I cannot really comment on those cases. I of course just ran cmake for the llvm build so I cannot give concrete numbers, only tendencies I've observed from various smaller-medium sized projects.

    In regards to Rust, the slowness is not even so much the compiler itself as it is cargo. I literally just tested it before writing this paragraph. The time it took to compile the basic hello world program was 0.159 seconds with rustc, and 0.718 seconds on the first run of "cargo build". However, running cargo build for a SECOND time produced a compile time of 0.043 seconds, because the caches were loaded up. Contrasting that, rustc on its second run was 0.13 seconds.

    So, a lot of it varies, however I can objectively say that on FIRST run of "cargo build", it is significantly slower than pretty much any compiler I have ever tried. That seems to be the price paid for the extra safety (and the convenience of cargo) so it's up to you what you find more important.

    Let's be real here though. How unsafe a program is is ultimately up to those who developed it. It is perfectly possible to create "safe" programs in languages like C or C++, even languages like Python. If you cover your bases, you should be fine in just about any language. What makes Rust special when it comes to safety is the fact that it FORCES everything to be "safe", even when it doesn't make much sense.

    At the end of the day, they're all good languages. Worrying about what language is the best is frankly just idiotic since they all have their pros and cons. Whatever works for you is amazing.

    For those curious, I decided to test C and C++ too.

    Hello world in C:
    cc – 0.193s
    gcc – 0.39s
    clang – 1.031s!!!!
    I ran clang a second time because wtf. Seems it needed the caches loaded too, because a secon run produced 0.058. So, an instance where clang was slower than gcc.

    C++:
    g++ – 0.719!!
    Ran it again, got 0.261
    clang++ – 0.390, much faster than g++ for the first run.
    The second run, 0.305, which was slightly slower than the g++ run.

    Mind you, that is just hello world, but it is still very indicative of the variance involved in making compile times slow or fast. If it varies that much for such a simple program, that says a lot.

    Bình luận
  2. Why is everyone so much talking about compile speed , I can wait 10 days to compile , no issues , but I want my code ultra performance because once it's done that code will stay there until the next version rolled out .. who is making these nonsense videos .. those who say compile slowness I guess doing it on small laptops , sure . Those who don't have a workstation making this judgement

    Bình luận

Viết một bình luận

bahis10bets.com betvole1.com casinomaxi-giris.com interbahis-giris1.com klasbahis1.com mobilbahisguncelgiris1.com piabetgiris1.com tipobettgiris.com tumbetgiris1.com betboro 1xbet giriş
bahis10bets.com betvole1.com casinomaxi-giris.com interbahis-giris1.com klasbahis1.com mobilbahisguncelgiris1.com piabetgiris1.com tipobettgiris.com tumbetgiris1.com betboro 1xbet giriş
antalya bayan escort
antalya bayan escort
antalya bayan escort