jarvis657 / goprotobuf

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

SPEED #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Seems that protocol buffers allow code to be generated for optimal speed 
without using reflect.

I would guess that this could easily be achieved by generating a Marshal() 
method for each Message.

I added:

option optimize_for = SPEED;

to the top of my file, below the package definition, but it does not seem to 
generate the code any differently from when I set it to CODE_SIZE.

Is this a missing feature or am I using it wrong?

Original issue reported on code.google.com by awalterschulze on 9 Jul 2012 at 2:26

GoogleCodeExporter commented 9 years ago
There is only one form of code generated by the Go protobuf compiler, and it is 
both fast and small. The option is ignored.

Original comment by r@golang.org on 9 Jul 2012 at 3:28

GoogleCodeExporter commented 9 years ago
I am impressed, I could not even achieve a consistent 2 times speed up, close 
though.

I couldn't believe that the usage of multiple reflects, some unsafe and a mutex 
did not result in a huge speed penalty.

Original comment by awalterschulze on 17 Jul 2012 at 2:11

GoogleCodeExporter commented 9 years ago
Sorry I forgot to attach my code.

Original comment by awalterschulze on 17 Jul 2012 at 2:12

Attachments: