kidok / protobuf

Automatically exported from code.google.com/p/protobuf
0 stars 0 forks source link

Code bloat caused by repeated_field.h #include'ing <algorithm> #654

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try preprocessing a .pb.cc file produced by protoc. Count the number of 
lines.
2. Now do the same as above, except before doing that, remove the statement  
#include <algorithm> from repeated_field.h.
3. You'll notice that the size of the preprocessed code reduces by some 22000 
lines just by this simple change. This causes a significant improvement in 
compilation speed.

What is the expected output? What do you see instead?

It seems #include <algorithm> is unnecessarily included in repeated_field.h.

What version of the product are you using? On what operating system?

protobuf-2.5.0. Ubuntu Linux.

Please provide any additional information below.

Original issue reported on code.google.com by mohit.a...@gmail.com on 11 Jul 2014 at 6:53

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Just removing '#include <algorithm>' from repeated_field.h reduced our 
compilation times by 10% throughout. The reason was that most .h or .cc files 
included some .pb.h file and that ended up unnecessarily including <algorithm> 
causing code bloat.

Original comment by mohit.a...@gmail.com on 11 Jul 2014 at 7:40

GoogleCodeExporter commented 9 years ago
Thanks for reporting this

Original comment by jie...@google.com on 17 Jul 2014 at 10:47

GoogleCodeExporter commented 9 years ago

Original comment by jie...@google.com on 26 Aug 2014 at 3:19