<commit_before>package engine

var depthMap = make(map[int8][]*GameObject)

func depthMapAdd(depth int8, object *GameObject) (index int) {
	arr := depthMap[depth]
	for i, obj := range arr {
		if obj == nil {
			index = i
			arr[i] = object
			return
		}
	}
	arr = append(arr, object)
	depthMap[depth] = arr
	return len(arr) - 1
}

func depthMapRemove(depth int8, index int) {
	if index >= 0 {
		arr := depthMap[depth]
		if index < len(arr) {
			arr[index] = nil
		}
	}
}<commit_msg>DepthMap should be faster now.<commit_after>package engine

var depthMap = make(map[int8][]*GameObject)

func depthMapAdd(depth int8, object *GameObject) (index int) {
	arr := depthMap[depth]
	arr = append(arr, object)
	depthMap[depth] = arr
	return len(arr) - 1
}

func depthMapRemove(depth int8, index int) (deleted bool) {
	if index >= 0 {
		arr := depthMap[depth]
		if index > len(arr)-1 {
			return false
		}
		arr[len(arr)-1], arr[index], depthMap[depth] = nil, arr[len(arr)-1], arr[:len(arr)-1]
		return true
	}
	return false
}
{'fraction_non_alphanumeric': 0.14468503937007873, 'fraction_numerical': 0.013779527559055118, 'mean_word_length': 3.9130434782608696, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, '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': '1411706', 'n_tokens_mistral': 406, 'n_tokens_neox': 381, 'n_words': 103}