Length caching to improve performance a little bit.
Merge pull request #2 from Mickael-van-der-Beek/master

[Performance ] Added length caching