<commit_before><!doctype html>
<html>
<head>
<style type="text/css">
body {
	font-size: 11px;
	font-family: monospace;
}

table.circle_output td {
	border-collapse: collapse;
}
table.circle_output td {
	border: 1px solid white;
	width: 15px;
	height: 15px;
}

.filled {
	background: red;
}

.cgy0, .cgx0 {
	background: #eee;
}

.filled.cgy0, .filled.cgx0 {
	background: #808080;
}

#height, #diameter, #scaler {
	width: 150px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<script src="range-polyfill.js"></script>
<script src="number-polyfill.js"></script>
<script>
window.addEvent('domready', function(){
	var dia         = $('diameter');
	var height      = $('height');
	var resultblock = $('result');
	var scaler      = $('scaler');
	var linked      = $('linked');
	var thickness   = $('thickness');
	var blockcount  = $('blockcount');

	var distance = function(x, y, ratio) {
		return Math.sqrt((Math.pow(y * ratio, 2)) + Math.pow(x, 2));
	}

	var filled = function(x, y, r, ratio) {
		return distance(x, y, ratio) <= r;
	}

	var fatfilled = function(x, y, r, ratio) {
		return filled(x, y, r, ratio) && !( 
			filled(x + 1, y, r, ratio) &&
			filled(x - 1, y, r, ratio) &&
			filled(x, y + 1, r, ratio) &&
			filled(x, y - 1, r, ratio) &&
			filled(x + 1, y + 1, r, ratio) &&
			filled(x + 1, y - 1, r, ratio) &&
			filled(x - 1, y - 1, r, ratio) &&
			filled(x - 1, y + 1, r, ratio)
		);
	}

	var draw = function(){
		var thick_t = thickness.get('value');
		var width_r = parseFloat(dia.value, 10) / 2;
		var height_r = parseFloat(height.value, 10) / 2;
		var ratio = width_r / height_r;

		var maxblocks_x, maxblocks_y;
		var text = '';
		var ifilled = 0;

		if ( (width_r * 2) % 2 == 0 ) {
			maxblocks_x = Math.ceil(width_r - .5) * 2 + 1;
		} else {
			maxblocks_x = Math.ceil(width_r) * 2;	
		}

		if ( (height_r * 2) % 2 == 0 ) {
			maxblocks_y = Math.ceil(height_r - .5) * 2 + 1;
		} else {
			maxblocks_y = Math.ceil(height_r) * 2;	
		}

		var hash = [width_r, height_r, thick_t].join();
		var circleTable = $$('table.circle_output')[0];
		if( !circleTable || circleTable.get('data-hash') != hash ) {
			text += '<table class="circle_output" data-hash="'+hash+'">';
			for (var y = -maxblocks_y / 2 + 1; y <= maxblocks_y / 2 - 1; y++) {
				text += '<tr>';
				for (var x =- maxblocks_x / 2 + 1; x <= maxblocks_x / 2 - 1; x++) {
					var xfilled;
					if( thick_t == 'thick' ) {
						xfilled = fatfilled(x, y, width_r, ratio);
					}else if( thick_t == 'thin' ){
						xfilled = fatfilled(x, y, width_r, ratio) && 
							!(fatfilled(x + (x > 0 ? 1 : -1), y, width_r, ratio) && fatfilled(x, y + (y > 0 ? 1 : -1), width_r, ratio));

					}else{
						xfilled = filled(x, y, width_r, ratio);<commit_msg>Very slight performance boost<commit_after><!doctype html>
<html>
<head>
<style type="text/css">
body {
	font-size: 11px;
	font-family: monospace;
}

table.circle_output td {
	border-collapse: collapse;
}
table.circle_output td {
	border: 1px solid white;
	width: 15px;
	height: 15px;
}

.filled {
	background: red;
}

.cgy0, .cgx0 {
	background: #eee;
}

.filled.cgy0, .filled.cgx0 {
	background: #808080;
}

#height, #diameter, #scaler {
	width: 150px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<script src="range-polyfill.js"></script>
<script src="number-polyfill.js"></script>
<script>
window.addEvent('domready', function(){
	var dia         = $('diameter');
	var height      = $('height');
	var resultblock = $('result');
	var scaler      = $('scaler');
	var linked      = $('linked');
	var thickness   = $('thickness');
	var blockcount  = $('blockcount');

	var distance = function(x, y, ratio) {
		return Math.sqrt((Math.pow(y * ratio, 2)) + Math.pow(x, 2));
	}

	var filled = function(x, y, r, ratio) {
		return distance(x, y, ratio) <= r;
	}

	var fatfilled = function(x, y, r, ratio) {
		return filled(x, y, r, ratio) && !( 
			filled(x + 1, y, r, ratio) &&
			filled(x - 1, y, r, ratio) &&
			filled(x, y + 1, r, ratio) &&
			filled(x, y - 1, r, ratio) &&
			filled(x + 1, y + 1, r, ratio) &&
			filled(x + 1, y - 1, r, ratio) &&
			filled(x - 1, y - 1, r, ratio) &&
			filled(x - 1, y + 1, r, ratio)
		);
	}

	var draw = function(){
		var thick_t = thickness.get('value');
		var width_r = parseFloat(dia.value, 10) / 2;
		var height_r = parseFloat(height.value, 10) / 2;
		var ratio = width_r / height_r;

		var maxblocks_x, maxblocks_y;
		var text = '';
		var ifilled = 0;

		if ( (width_r * 2) % 2 == 0 ) {
			maxblocks_x = Math.ceil(width_r - .5) * 2 + 1;
		} else {
			maxblocks_x = Math.ceil(width_r) * 2;	
		}

		if ( (height_r * 2) % 2 == 0 ) {
			maxblocks_y = Math.ceil(height_r - .5) * 2 + 1;
		} else {
			maxblocks_y = Math.ceil(height_r) * 2;	
		}

		var hash = [width_r, height_r, thick_t].join();
		var circleTable = $$('table.circle_output')[0];
		if( !circleTable || circleTable.get('data-hash') != hash ) {
			text += '<table class="circle_output" data-hash="'+hash+'">';
			for (var y = -maxblocks_y / 2 + 1; y <= maxblocks_y / 2 - 1; y++) {
				text += '<tr>';
				for (var x =- maxblocks_x / 2 + 1; x <= maxblocks_x / 2 - 1; x++) {
					var xfilled;

					if( filled(x, y, width_r, ratio) ) {
						if( thick_t == 'thick' ) {
							xfilled = fatfilled(x, y, width_r, ratio);
						}else if( thick_t == 'thin' ){
							xfilled = fatfilled(x, y, width_r, ratio) && 
								!(fatfilled(x + (x > 0 ? 1 : -1), y, width_r, ratio) && fatfilled(x, y + (y > 0 ? 1 : -1), width_r, ratio));

						}else{
							xfilled = true;
						}
					}else{
						xfilled = false;
{'fraction_non_alphanumeric': 0.19522546419098144, 'fraction_numerical': 0.02581786030061892, 'mean_word_length': 2.930507296733843, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, 'https://': 2, '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': '3888415', 'n_tokens_mistral': 2627, 'n_tokens_neox': 2249, 'n_words': 579}