<commit_before>package com.idunnolol.ragefaces.data;

import java.lang.ref.SoftReference;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Cache {

	private static final Map<Integer, SoftReference<Bitmap>> mCache = new ConcurrentHashMap<Integer, SoftReference<Bitmap>>();

	public static Bitmap getBitmap(Resources res, Integer id) {
		Bitmap bitmap = null;

		SoftReference<Bitmap> ref = mCache.get(id);
		if (ref != null) {
			bitmap = ref.get();
		}

		if (bitmap == null) {
			bitmap = BitmapFactory.decodeResource(res, id);
			mCache.put(id, new SoftReference<Bitmap>(bitmap));
		}

		return bitmap;
	}
}<commit_msg>Upgraded to a proper Bitmap cache<commit_after>package com.idunnolol.ragefaces.data;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v4.util.LruCache;

public class Cache {

	private static final int MAX_MEMORY = (int) (Runtime.getRuntime().maxMemory() / 1024);

	private static final LruCache<Integer, Bitmap> sMemoryCache = new LruCache<Integer, Bitmap>(MAX_MEMORY / 3) {
		@Override
		protected int sizeOf(Integer key, Bitmap bitmap) {
			return (bitmap.getRowBytes() * bitmap.getHeight()) / 1024;
		}
	};

	public static Bitmap getBitmap(Resources res, Integer id) {
		Bitmap bitmap = sMemoryCache.get(id);

		if (bitmap == null) {
			bitmap = BitmapFactory.decodeResource(res, id);
			sMemoryCache.put(id, bitmap);
		}

		return bitmap;
	}
}
{'fraction_non_alphanumeric': 0.11654135338345864, 'fraction_numerical': 0.006265664160401002, 'mean_word_length': 4.9148148148148145, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7053770', 'n_tokens_mistral': 537, 'n_tokens_neox': 491, 'n_words': 122}