<commit_before>var map = {
    height:  1500,
    width:  10000,
    generate: function(){
        map.context.fillStyle = "white";
        var rightmost = 0;
        var jobs = 0;
        var processed = 0;
        var time = new Date() - 0;
        var queue = [];
        var queue_right = [];
        var width = map.width;
        var img = map.context.getImageData(0, 0, map.width, map.height);
        function v(x, y, z){
            return map.perlin.noise(x/900, y/900, z?z:0) +
                map.perlin.noise(x/250, y/250, z?z:0) +
                map.perlin.noise(x/90, y/60, z?z:0)/9 +
                map.perlin.noise(x/3, y/3, 0)/100 +
                linear(y, 0, map.canvas.height, -1, 1)*2 +
                Math.pow(linear(x, 0, map.width, -1, 1), 6)
                - 0.1;
        }
        function floodfill(x, y){
            if(x > rightmost){
                rightmost = x;
            }
            img.data[(x + y * width) * 4] = 255; // transparent red, mark as seen
            var bg = v(x, y, 0.5) > -0.1;
            var fg = v(x, y, 0) > 0;
            if(bg || fg){
                //img.data[(x + y * width) * 4] = 255; // already done up there ↑
                img.data[(x + y * width) * 4 + 1] = 255;
                img.data[(x + y * width) * 4 + 2] = 255;
                img.data[(x + y * width) * 4 + 3] = fg?255:31;
                if(y > 0                     && img.data[(x   + (y-1) * width) * 4] === 0) { queue.push      ([x  , y-1]); img.data[(x   + (y-1) * width) * 4] = 255; }
                if(x < map.canvas.width - 1  && img.data[(x+1 + (y  ) * width) * 4] === 0) { queue_right.push([x+1, y  ]); img.data[(x+1 + (y  ) * width) * 4] = 255; }
                if(x > 0                     && img.data[(x-1 + (y  ) * width) * 4] === 0) { queue.push      ([x-1, y  ]); img.data[(x-1 + (y  ) * width) * 4] = 255; }
                if(y < map.canvas.height - 1 && img.data[(x   + (y+1) * width) * 4] === 0) { queue.push      ([x  , y+1]); img.data[(x   + (y+1) * width) * 4] = 255; }
            }
            processed += 1;
            var job = queue.shift() || queue_right.shift();
            if(job){
                if(processed % 1500 === 0){
                    progress(linear(rightmost, 0, map.width, 0, 95), "Generating map, " + (queue.length + queue_right.length) + " queued...");
                    window.setTimeout(floodfill, 0, job[0], job[1]);
                }
                else
                    floodfill(job[0], job[1]);
            }
            else {
                if(processed < map.width*map.height/8){ processed = 0; floodfill(x+1, y); return; } // we landed on a tiny island or empty space, try again
                map.context.putImageData(img, 0, 0);
                map.imageData = img;<commit_msg>fix "call stack size exceeded"<commit_after>var map = {
    height:  1500,
    width:  10000,
    generate: function(){
        map.context.fillStyle = "white";
        var rightmost = 0;
        var jobs = 0;
        var processed = 0;
        var time = new Date() - 0;
        var queue = [];
        var queue_right = [];
        var width = map.width;
        var img = map.context.getImageData(0, 0, map.width, map.height);
        function v(x, y, z){
            return map.perlin.noise(x/900, y/900, z?z:0) +
                map.perlin.noise(x/250, y/250, z?z:0) +
                map.perlin.noise(x/90, y/60, z?z:0)/9 +
                map.perlin.noise(x/3, y/3, 0)/100 +
                linear(y, 0, map.canvas.height, -1, 1)*2 +
                Math.pow(linear(x, 0, map.width, -1, 1), 6)
                - 0.1;
        }
        function floodfill(x, y){
            if(x > rightmost){
                rightmost = x;
            }
            img.data[(x + y * width) * 4] = 255; // transparent red, mark as seen
            var bg = v(x, y, 0.5) > -0.1;
            var fg = v(x, y, 0) > 0;
            if(bg || fg){
                //img.data[(x + y * width) * 4] = 255; // already done up there ↑
                img.data[(x + y * width) * 4 + 1] = 255;
                img.data[(x + y * width) * 4 + 2] = 255;
                img.data[(x + y * width) * 4 + 3] = fg?255:31;
                if(y > 0                     && img.data[(x   + (y-1) * width) * 4] === 0) { queue.push      ([x  , y-1]); img.data[(x   + (y-1) * width) * 4] = 255; }
                if(x < map.canvas.width - 1  && img.data[(x+1 + (y  ) * width) * 4] === 0) { queue_right.push([x+1, y  ]); img.data[(x+1 + (y  ) * width) * 4] = 255; }
                if(x > 0                     && img.data[(x-1 + (y  ) * width) * 4] === 0) { queue.push      ([x-1, y  ]); img.data[(x-1 + (y  ) * width) * 4] = 255; }
                if(y < map.canvas.height - 1 && img.data[(x   + (y+1) * width) * 4] === 0) { queue.push      ([x  , y+1]); img.data[(x   + (y+1) * width) * 4] = 255; }
            }
            processed += 1;
            var job = queue.shift() || queue_right.shift();
            if(job){
                if(processed % 1500 === 0){
                    progress(linear(rightmost, 0, map.width, 0, 95), "Generating map, " + (queue.length + queue_right.length) + " queued...");
                    window.setTimeout(floodfill, 0, job[0], job[1]);
                }
                else
                    floodfill(job[0], job[1]);
            }
            else {
                if(processed < map.width*map.height/8){ processed = 0; window.setTimeout(floodfill, 0, x+1, y); return; } // we landed on a tiny island or empty space, try again
                map.context.putImageData(img, 0, 0);
                map.imageData = img;
{'fraction_non_alphanumeric': 0.17898486197684774, 'fraction_numerical': 0.05075690115761353, 'mean_word_length': 1.3517587939698492, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '25070', 'n_tokens_mistral': 2188, 'n_tokens_neox': 1913, 'n_words': 479}