Timing hash functions with the bench package

This blog post has two goals Investigate the {bench} package for timing R functions Consequently explore the different algorithms in the {digest} package using {bench} What is {digest}? The {digest} package provides a hash function to summarise R objects. Standard hashes are available, such as md5, crc32, sha-1, and sha-256. The key function in the package is digest() that applies a cryptographical hash function to arbitrary R objects. By default, the objects are internally serialized using md5.

Timing in R

As time goes on, your R scripts are probably getting longer and more complicated, right? Timing parts of your script could save you precious time when re-running code over and over again. Today I’m going to go through the 4 main functions for doing so. Nested timings 1) Sys.time() Sys.time() takes a “snap-shot” of the current time and so it can be used to record start and end times of code.