earwig/mwparserfromhell — pull request #64 by marciof (2014-03-20 08:06:33+00:00)
Title: Token creation speedup

Hi,

After doing some profiling, I noticed that the Token constructor is one of the functions that uses the most time (out of parsing). Changing the class to inherit from dict yields the same semantics and avoids the costly custom constructor.

Before:
```
$ python -m timeit -s 'from mwparserfromhell.parser.tokens import Text' 'Text(text = "abc")'
1000000 loops, best of 3: 0.91 usec per loop
```

After:
```
$ python -m timeit -s 'from mwparserfromhell.parser.tokens import Text' 'Text(text = "abc")'
1000000 loops, best of 3: 0.223 usec per loop
```

It's a ~4x speed-up. What do you think of the change?