Hacker News new | past | comments | ask | show | jobs | submit login

The compile times are not that long unless your program is very big. I also have 10 year old hardware.



I guess it depends on what you're used to. Each time I switch from C to C++, compile times take some adjusting.

If you're not careful about how you organise your C++ code (be careful what you put in headers, don't go crazy with templates), compiling can get really slow, even for relatively small projects.

Just #include <iostream> and the compiler needs to process 37,799(!) lines and more than a MB of data:

  echo '#include <iostream>' | g++ -E  -x c++ - | wc
     37799  104779 1280834
To contrast in C:

  echo '#include <stdio.h>' | gcc -E  -x c - | wc
       456    1638   20880
Comparing the compile times of PostgreSQL (C, minutes on an old laptop) and MySQL (C++, 30+ minutes) is also instructive.

Maybe when modules are finally introduced, things will improve.


The numbers seem to depend heavily on your environment, by the way:

  $ uname -m
  x86_64
  $ source /etc/os-release && echo $NAME
  Arch Linux
  $ echo '#include <iostream>' | g++ -E  -x c++ - | wc
    27336   59448  643240


Sure. Mine was macOS Sierra.

If your <stdio> is comparable to mine, that's still about 30 times more bytes that the compiler sees for C++ compared to C.


I'd edit this into the original comment if I could; here seems to be a good spot to put it.

I think I should add a bit of context about what I mean by slow compile times: I feel comfortable if I can hit CTRL+S* and have my code rerun or restart within about half a second. At one second, it should either be executing or have output something and finished, and if it takes more than about 10 seconds to get to whatever point I'm prototyping or making a decision on, I get jittery.

It's partly because I have a ridiculously short feedback loop, but also because I am (for some reason) sensitive to interactivity latency and I prioritize responsiveness extremely highly. So long compile times tend to lean on those buttons and make me uncomfortable.

With this in mind, the only C++ experience I've had yet was doing some modifications to the Dillo web browser, which was the main web browser I was running on the 800MHz AMD Duron box I used between 2012-2014 (the same one I described in https://news.ycombinator.com/item?id=13344332).

It was a lot of fun - I modified the tab bar so tabs could be dragged around, moved between windows, etc :D - but the compile times were around 3 seconds! This was just for the test harness I built which had an absolute minimum of code in it; I was also using GCC precompiled headers for literally everything (my prototype code was a ~300 line .cpp file, no headers or anything). This was a really big adjustment for someone used to tcc (~10ms compile time) or gcc (~300ms compile time) who felt that gcc took juuuust a bit too long to do its thing.

I've seen C and C++ code compile on friends' i3 boxes (haven't seen what an i7 can do yet) and been amazed. I think when I have a machine like that I'll probably be able to seriously get into the language. (I actually have an i3 here but it had a memory failure several months ago, hopefully I can get some new DIMMs for it soon and see if the motherboard actually still works.)

--

* About ^S - I'm yet to play with Emacs which I understand has two keystrokes to save files; I mostly use Vim because it's installed everywhere. I far prefer ^S over ESC (Press)Shift ; (Release)Shift w Return i/a.


With the failure of Lisp Machines, Lucid pivoted into doing a Lisp like interactive environment for C++, with compilation at function/method level. There is an old VHS video that some uploaded to YouTube demoing it. Search for Lucid C++.

The last version of Visual C++ (v4) used a database repository as binary representation of C++ code, also offering an interactive experience.

The problem with both environments was that they required powerful hardware that most people weren't wiling to pay for and consequently died.

Microsoft is now having a smarter linker with db support for VSC++ 2017.

Both Apple and Google were discussing at last LLVM conference how to add similar capabilities, IDE friendly, to clang, partially based on the Swift Playgrounds development experience.


I think I vaguely recall learning about database-incorporating C++ compilers recently, and now I actually see them. This is really neat.

I'm definitely looking forward to LLVM getting these capabilities. It'll move C++ development forward by light years, I reckon. (For example, Chrome takes an hour to fully rebuild in CI on what I suspect is fairly modern server hardware.)


Here are the Lucid and IBM compilers I talked about.

Lucid Energize Demo VHS 1993

https://www.youtube.com/watch?v=pQQTScuApWk

IBM VisualAge C++ Professional 4.0

http://www.edm2.com/index.php/IBM_VAC_4.0

Sadly there isn't much information online, as this was on the days of BBS, Compuserve and other early online services.


Wow, that's really awesome.

If only the source code at https://archive.org/details/archiveteam-lucid-collection was complete :( that would be one source to getting a copy I could play with.

I'm definitely checking out VA C++ at some point though.

Thanks!


Its all relative.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: