google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
71 stars 21 forks source link

Improve perf of C++ backend #125

Closed EricRahm closed 5 months ago

EricRahm commented 6 months ago

As part of my ongoing analysis of emboss performance (see #118, #119 #122) I took a look at profiling just the C++ backend. The same methodology applies.

Analysis

image

Drilling in a little more we can see that 13% of time is spent formatting the code templates: image

Proposal

  1. Ignore the deserialization overhead for now, other issues should cover that
  2. Replace our bespoke template formatting with string.Template. A proof-of-concept shows that reduces overhead by 11%. image