boto/jmespath — pull request #45 by jamesls (2014-03-02 23:40:48+00:00)
Title: Generate/cache LR tables

Add scripts to generate the lr tables.

This allows the parser to used the cached lr table for a significant
performance boost.

Due to the way that ply caches/verifies the generated lr table, we
need different versions for both py3 and py2.

What this means in practice is that you'll have to run
bin/gen-tables on both python2 and python3 when changing the grammar.

## Pertest

Before:

```
$ python perf/perftest.py
lex_time: 0.70691109, parse_time: 21.07691765ms, search_time: 0.00095367ms description: Basic minimal case name: single_expression
lex_time: 0.72193146, parse_time: 20.92409134ms, search_time: 0.00190735ms description: Basic minimal case name: single_dot_expression
lex_time: 0.74481964, parse_time: 21.98386192ms, search_time: 0.00381470ms description: Basic minimal case name: double_dot_expression
lex_time: 0.74601173, parse_time: 22.14598656ms, search_time: 0.00500679ms description: Basic minimal case name: dot_no_match
lex_time: 0.80204010, parse_time: 21.95596695ms, search_time: 0.01287460ms description: Deeply nested dict name: deep_nesting_10
lex_time: 1.19590759, parse_time: 23.03290367ms, search_time: 0.06580353ms description: Deeply nested dict name: deep_nesting_50
lex_time: 0.76508522, parse_time: 21.16608620ms, search_time: 0.02002716ms description: Multiple wildcards in an expression name: multi_wildcard_field
lex_time: 0.76913834, parse_time: 20.80392838ms, search_time: 0.01692772ms description: Multiple wildcards in an expression name: wildcard_with_index
lex_time: 0.73695183, parse_time: 20.82395554ms, search_time: 0.00786781ms description: Multiple wildcards name: wildcard_with_field_match
lex_time: 0.73599815, parse_time: 21.21019363ms, search_time: 0.00691414ms description: Multiple wildcards name: wildcard_with_field_match2
```

After:

```
$ python perf/perftest.py
lex_time: 0.70500374, parse_time: 1.04904175ms, search_time: 0.00095367ms description: Basic minimal case name: single_expression
lex_time: 0.71716309, parse_time: 1.07908249ms, search_time: 0.00190735ms description: Basic minimal case name: single_dot_expression
lex_time: 0.72908401, parse_time: 1.10197067ms, search_time: 0.00381470ms description: Basic minimal case name: double_dot_expression
lex_time: 0.73695183, parse_time: 1.12509727ms, search_time: 0.00596046ms description: Basic minimal case name: dot_no_match
lex_time: 0.79202652, parse_time: 1.26218796ms, search_time: 0.01287460ms description: Deeply nested dict name: deep_nesting_10
lex_time: 1.18780136, parse_time: 2.18391418ms, search_time: 0.06580353ms description: Deeply nested dict name: deep_nesting_50
lex_time: 0.75483322, parse_time: 1.16801262ms, search_time: 0.01978874ms description: Multiple wildcards in an expression name: multi_wildcard_field
lex_time: 0.76293945, parse_time: 1.17111206ms, search_time: 0.00000000ms description: Multiple wildcards in an expression name: wildcard_with_index
lex_time: 0.72908401, parse_time: 1.11103058ms, search_time: 0.00786781ms description: Multiple wildcards name: wildcard_with_field_match
lex_time: 0.73194504, parse_time: 1.10793114ms, search_time: 0.00691414ms description: Multiple wildcards name: wildcard_with_field_match2
```