Use the following file with your own timing code around the call to *delete 
msg* in main(). When running in debug mode, it is taking 473 times as long, 
on average, as when running without debugging.
I am using Visual Studio 2008 SP 1 on a Windows 7 machine.


#include "PropMsg.ph.h"

 

void RawSerializer::serialize(int i_val, PropMsg * o_msg)
> {
>         o_msg->set_v_int32(i_val);
> }
> void serialize(std::vector<int> const & i_val, PropMsg * o_msg)
> {
>     for (std::vector<int>::const_iterator it = i_val.begin(); it != 
> i_val.end(); ++it) {
>         PropMsg * objMsg = o_msg->add_v_var_repeated();
>         serialize( * it, objMsg);
>     }
> }
>
 

int main()
> {
>     std::vector<int> testVec(100000);
>     PropMsg * msg = new PropMsg;
>     serialize(testVec, msg);
>     delete msg; // Time this guy

}


*PropMsg* was created with the following .proto file definition:

option optimize_for = SPEED;
> message PropMsg
> {
>   optional int32 v_int32 = 7;
>   repeated PropMsg v_var_repeated = 101;
> }

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/-UiW3LqTd0UJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to