<commit_before>Function.implement({
	time: function(message, that, args){
		var s = $time()
		var r = this.apply(that, $splat(args))
		console.log((message || "") + " " + ($time() - s))
		return r
	},
	avg_time: function(message, that, args){
		if (!this.avg_time_storage) this.avg_time_storage = {times:[]}
		var s = $time()
		var r = this.apply(that, $splat(args))
		
		this.avg_time_storage.times.push($time() - s)
		$clear(this.avg_time_storage.timer)
		this.avg_time_storage.timer = ( function() {
			console.log(
				(message || "")
				+ " took "
				+ this.avg_time_storage.times.average() + "ms on average and executed " 
				+ this.avg_time_storage.times.length + " times")
		} ).delay(1000, this)
		
		return r
	}
});

Array.implement({
	average: function(){
		var total = 0
		this.each(function(x){
			total += x
		})
		return total/this.length
	}
});<commit_msg>storage keyed off message, for multiple avg_time calls on a specific function.<commit_after>Function.implement({
	time: function(message, that, args){
		var s = $time()
		var r = this.apply(that, $splat(args))
		console.log((message || "") + " " + ($time() - s))
		return r
	},
	avg_time: function(message, that, args){
		if (!this.avg_time_storage) this.avg_time_storage = {}
		if (!this.avg_time_storage[message]) this.avg_time_storage[message] = {times:[]}
		var storage = this.avg_time_storage[message]
		
		var s = $time()
		var r = this.apply(that, $splat(args))

		storage.times.push($time() - s)
		$clear(storage.timer)
		storage.timer = ( function() {
			console.log(message 
				+ " took "
				+ storage.times.average() + "ms on average and executed " 
				+ storage.times.length + " times")
		} ).delay(1000, this)
		
		return r
	}
});

Array.implement({
	average: function(){
		var total = 0
		this.each(function(x){
			total += x
		})
		return total/this.length
	}
});
{'fraction_non_alphanumeric': 0.171875, 'fraction_numerical': 0.005387931034482759, 'mean_word_length': 3.585185185185185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4345806', 'n_tokens_mistral': 746, 'n_tokens_neox': 661, 'n_words': 142}