#!/usr/bin/r

n.strings = 1000
n.letters = 100
n.repetitions = 100

strings = replicate(n.strings, paste(sample(letters, n.letters, replace=TRUE), collapse=""))

library(gsubfn)
results = list(
	system.time(replicate(n.repetitions, gsub('a|(*COMMIT)(*FAIL)', '-', strings, perl=TRUE))),
	system.time(replicate(n.repetitions, gsubfn('^a*', ~ paste(rep('-', nchar(x)), collapse=""), strings))),
	system.time(replicate(n.repetitions, gsubfn('^a*', ~ gsub('.', '-', x), strings))))
	
print(results)
