szaszm commented on a change in pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192#discussion_r721632735
##########
File path: extensions/http-curl/tests/C2LogHeartbeatTest.cpp
##########
@@ -17,14 +17,18 @@
*/
#undef NDEBUG
+
#include "TestBase.h"
+
#include "c2/C2Agent.h"
+#include "c2/HeartbeatLogger.h"
#include "protocols/RESTProtocol.h"
#include "protocols/RESTSender.h"
#include "HTTPIntegrationBase.h"
#include "HTTPHandlers.h"
+#include "range/v3/all.hpp"
Review comment:
Ranges are powerful, but the range-v3 lib is also not the fastest to
compile. On my machine, the difference is about 0.6 seconds between a
translation unit that includes all vs. only the necessary utils. It's not a big
deal, but it's also an easy improvement.
The list of includes necessary here are:
```
#include "range/v3/view/split.hpp"
#include "range/v3/view/transform.hpp"
#include "range/v3/view/filter.hpp"
#include "range/v3/range/conversion.hpp"
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
```
I recognize that this is a bit tedious, but it will only last until we can
migrate to standard ranges. I'm also not insisting on the change if 0.6 seconds
of saved compilation time is not convincing enough to spend extra time looking
up the necessary headers.
My tests:
```
szaszm@szaszm-pc:~$ cat ranges-all.cpp
#include "range/v3/all.hpp"
#include <cstdio>
int main() { puts("Hello world"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-all ranges-all.cpp -std=c++2a -O3
-Wall -Wextra -pedantic -flto
real 0m1.221s
user 0m1.129s
sys 0m0.090s
szaszm@szaszm-pc:~$ cat ranges-selective.cpp
#include "range/v3/view/split.hpp"
#include "range/v3/view/transform.hpp"
#include "range/v3/view/filter.hpp"
#include "range/v3/range/conversion.hpp"
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-selective ranges-selective.cpp
-std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.670s
user 0m0.601s
sys 0m0.068s
szaszm@szaszm-pc:~$ cat ranges-selective2.cpp
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-selective2 ranges-selective2.cpp
-std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.591s
user 0m0.535s
sys 0m0.055s
szaszm@szaszm-pc:~$ cat ranges-std.cpp
#include <ranges>
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-std ranges-std.cpp -std=c++2a -O3
-Wall -Wextra -pedantic -flto
real 0m0.370s
user 0m0.326s
sys 0m0.043s
```
##########
File path: libminifi/include/core/ClassLoader.h
##########
@@ -24,10 +24,10 @@
#include <string>
#include <map>
#include <memory>
-#include "utils/StringUtils.h"
+
#include "core/Core.h"
-#include "io/BufferStream.h"
#include "ObjectFactory.h"
+#include "range/v3/all.hpp"
Review comment:
Same here. Interestingly, the difference is still about 0.6 seconds
despite using less utilities.
```
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]