Various bug/performance fixes and benchmark tool

timeit.benchmark(fn1, fn2, fn3, varargs)
or timeit.benchmark(fn1, fn2, fn3, {varargs})
or timeit.benchmark(fn1, {args1}, fn2, {args2}, fn3, {args3}, ...)
Optional first argument for number of repetitions, default 1000

Added table.chunks(t, size), split array into equally sized chunks.
Added table.min(t) and table.max(t).
Improved table.reverse(t) internally.

Fixed math.log.

Fixed functools.apply(fn, args) and functools.endapply(fn, args).

Fixed xml.entity_unescape(_, entity) (for internal use in gsub only).

Added string.lpad(str, pad, len) and string.rpad(str, pad, len).