<commit_before>import uk.co.bbc.redux._
import java.util.Date
import java.awt.image.BufferedImage
import com.thebuzzmedia.imgscalr._

var username:String = Console.readLine("Redux User: ")
var password:String = Console.readLine("Redux Pass: ")

var client:Client   = new Client
var user:User       = client.login(username, password)
var content:Content = client.content("5645630572656380584", user.session)
var frames:Frames

def benchmark (description:String) (block: => Unit) {
  var start:Date = new Date
  block
  var time:Long = (new Date).getTime() - start.getTime()
  println(description+" took : "+time.toString+" ms")
}

benchmark ("Loding frames object from Redux API") {
  frames = client.frames(content.diskReference, 1, content.key)
}

benchmark ("Get "+frames.seconds.toString+" frames from a Frames object") {
  for (i <- 0 until frames.seconds) {
    var frame:BufferedImage = frames.getFrame(i)
  }
}

benchmark ("Scale by 0.5, "+frames.seconds.toString+" frames from a Frames object") {
  for (i <- 0 until frames.seconds) {
    var frame:BufferedImage = frames.getFrame(i)
    Scalr.resize(frame, Scalr.Method.AUTOMATIC, frames.FRAME_WIDTH / 2, frames.FRAME_HEIGHT / 2, null)
  }
}

client.logout(user)
<commit_msg>Add benchmark script<commit_after>import uk.co.bbc.redux._
import java.util.Date
import java.awt.image.BufferedImage
import com.thebuzzmedia.imgscalr._

var username:String = Console.readLine("Redux User: ")
var password:String = Console.readLine("Redux Pass: ")

var client:Client   = new Client
var user:User       = client.login(username, password)
var content:Content = client.content("5645630572656380584", user.session)
var frames:Frames   = null

def benchmark (description:String) (block: => Unit) {
  var start:Date = new Date
  block
  var time:Long = (new Date).getTime() - start.getTime()
  println(description+" took : "+time.toString+" ms")
}

benchmark ("Loading frames object from Redux API") {
  frames = client.frames(content.diskReference, 1, content.key)
}

benchmark ("Get "+frames.seconds.toString+" frames from a Frames object") {
  for (i <- 0 until frames.seconds) {
    var frame:BufferedImage = frames.getFrame(i)
  }
}

benchmark ("Scale by 0.5, "+frames.seconds.toString+" frames from a Frames object") {
  for (i <- 0 until frames.seconds) {
    var frame:BufferedImage = frames.getFrame(i)
    Scalr.resize(frame, Scalr.Method.AUTOMATIC, frames.FRAME_WIDTH / 2, frames.FRAME_HEIGHT / 2, null)
  }
}

client.logout(user)

{'fraction_non_alphanumeric': 0.13158953722334005, 'fraction_numerical': 0.020925553319919517, 'mean_word_length': 4.536748329621381, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5252826', 'n_tokens_mistral': 850, 'n_tokens_neox': 806, 'n_words': 207}