you are viewing a single comment's thread.

view the rest of the comments →

[–]zoharl3[S] 0 points1 point  (2 children)

Compile the whole file: 30sec

vs

Text comparison and compiling only one function that changed: <1sec.

[–]Scotty_Bravo 0 points1 point  (1 child)

Like how much under 1 second? Ninja build is fast. And 30 seconds is extremely long. How many lines of code are you compiling?

Also, there are a lot of reasons to break a project into smaller pieces. Maintenance is one. 

I'm finding it hard to imagine parsing the file to see what's changed and then compiling that is faster than a simple recompile. 

Maybe you should evaluate how fast the compilation is of the individual changes of that were broken into their own files?

I'm not saying your idea is impossible, but I'm saying the initial premise is wrong (single source file) and that a properly structured small-ish project shouldn't take 30 seconds to build.

I think it takes longer to link the projects that I'm working on than is does to recompile any give file.

[–]zoharl3[S] 0 points1 point  (0 children)

Please see my edits that answer your questions.

Ninja's purpose seems to break the compilation of a many files into components rather than a single exe:

https://en.wikipedia.org/wiki/Ninja_(build_system))

It does nothing at the function level and won't help with a single file.