larroy commented on issue #14095: Optimize move semantics of NodeEntry URL: https://github.com/apache/incubator-mxnet/pull/14095#issuecomment-494129614 @szha Performance is the same, so motivation is correctness and ease of graph building: Tested in a tight loop: ``` TEST(NodeTestX, NodeTest) { using namespace nnvm; using namespace std; using namespace std::chrono; vector<nnvm::NodeEntry> v; nnvm::NodePtr ng = nnvm::Node::Create(); ng->attrs.op = Op::Get("_zeros_without_dtype"); ng->attrs.name = "zeros_without_dtype"; #if 0 high_resolution_clock::time_point t1 = high_resolution_clock::now(); for(size_t i = 0; i < 10000000; ++i) { v.push_back(NodeEntry{ng, 0, 0}); } high_resolution_clock::time_point t2 = high_resolution_clock::now(); auto duration = duration_cast<microseconds>( t2 - t1 ).count(); cout << duration; #endif #if 1 auto t1 = high_resolution_clock::now(); for(size_t i = 0; i < 10000000; ++i) { v.emplace_back(ng, 0, 0); } auto t2 = high_resolution_clock::now(); auto duration = duration_cast<microseconds>( t2 - t1 ).count(); cout << duration; #endif } ``` ``` piotr@ec2 cpu:0: ~/mxnet [master]> build/tests/mxnet_unit_tests --gtest_filter="NodeTest*" Note: Google Test filter = NodeTest* [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from NodeTestX [ RUN ] NodeTestX.NodeTest 1659863[ OK ] NodeTestX.NodeTest (1918 ms) [----------] 1 test from NodeTestX (1918 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (1919 ms total) [ PASSED ] 1 test. ``` ``` Note: Google Test filter = NodeTest* [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from NodeTestX [ RUN ] NodeTestX.NodeTest 1717020[ OK ] NodeTestX.NodeTest (1985 ms) [----------] 1 test from NodeTestX (1985 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (1985 ms total) [ PASSED ] 1 test. ```
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
