Optimizing diff engine to cache string length() calls

A single call to diff for some passages (chapter long) could call 170'000 length().
There are more issues to be optimized, namely the boxing/unboxing of integers. The current fix gives us a 10% performance increase on compare. The boxing would be another 10%. (there's a third avoidable issue, but can't quite remember what it was)

For the unboxing/boxing - i think we could just use an array of integers where the array index is the key to the value and check for -1/MAX_VALUE or something like that This would save all unboxing/boxing occurring in the code.