title: How to benchmark Boost Spirit Parser?
body: <p>I'm working on a compiler and I would like to improve its performances. I found that about 50% of the time is spent parsing the source files. As the source file are quite small and I do quite a lot of transformations after that, it seems to me that it is perfectible. </p>
  
  <p>My parser is a Boost Spirit parser with a lexer (with lexer::pos_iterator) and I have a middle sized grammar. I'm parsing the source into an AST. </p>
  
  <p>My problem is that I have no idea what takes the most time during the parsing: copies of AST nodes, lexer, parser rules or memory. </p>
  
  <p>I don't think that it is I/O problem since I'm working on a SSD and that I'm reading the file entirely at the beginning and then using only the memory version. </p>
  
  <p>I tried using profilers, but the methods that takes time are some methods from Boost with names hundreds of characters long and I don't know exactly what they do...</p>
  
  <p>So, is there a preferred way to benchmark a Boost Spirit Parser and its grammar ? 
  Or is there some rules that can be used to verify the efficiency at some specific points ?</p>
  
  <p>Thanks</p>
  
  <p>Sources for those interested:</p>
  
  <ul>
  <li><a href="https://github.com/wichtounet/eddic/blob/develop/src/parser/SpiritParser.cpp">Parser</a></li>
  <li><a href="https://github.com/wichtounet/eddic/blob/develop/src/parser/EDDIGrammar.cpp">Grammar</a> <a href="https://github.com/wichtounet/eddic/blob/develop/src/parser/TypeGrammar.cpp">Grammar</a> <a href="https://github.com/wichtounet/eddic/blob/develop/src/parser/ValueGrammar.cpp">Grammar</a></li>
  <li><a href="https://github.com/wichtounet/eddic/blob/develop/include/lexer/SpiritLexer.hpp">Lexer</a></li>
  </ul>