<commit_before>var mapnik = require('mapnik');

/**
 * A pool of maps
 */
module.exports = new function() {
    return {
        get: function(mapfile) {
            delete this.m;
            this.m = new mapnik.Map(256, 256);
            this.m.load(mapfile);
            this.m.buffer_size(128);
            return this.m;
        }
    };
}<commit_msg>Get a little more intelligent about map reloading...<commit_after>var mapnik = require('mapnik');

/**
 * A pool of maps
 */
module.exports = new function() {
    return {
        get: function(mapfile) {
            if (this.mapfile == mapfile) {
                return this.m;
            } else {
                this.mapfile = mapfile;
                console.log('loaded anew');
                this.m && this.m.clear();
                this.m = new mapnik.Map(256, 256);
                this.m.load(mapfile);
                this.m.buffer_size(128);
                return this.m;
            }
        }
    };
}
{'fraction_non_alphanumeric': 0.13230769230769232, 'fraction_numerical': 0.018461538461538463, 'mean_word_length': 1.427860696517413, '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': '7522108', 'n_tokens_mistral': 309, 'n_tokens_neox': 285, 'n_words': 63}