<commit_before>

$.index.open();


var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');

// 1: Create a function that declares what the DOM should look like

function render(count)  {
    return h('View', {
    	namespace : 'UI',
        style: {
            borderColor: 'blue',
            borderWidth : 1,
            width: (100 + count),
            height: (100 + count),
        }
    }, [
    	h('Label', {
	    	namespace : 'UI',
	        style: {
	            textAlign: 'center',
	            borderColor: 'red',
	            borderWidth : 1,
	            width: Ti.UI.SIZE,
	            height: Ti.UI.FILL,
	            text : count
	        }
	    }, [
	    	//String(count)
	    ])
    ]);
}



// 2: Initialise the document

var count = 0;      // We need some app data. Here we just store a count.

var tree = render(count);               // We need an initial tree
console.log(tree);

var rootNode = createElement(tree,{
	warn : console.log
});     // Create an initial root DOM node ...
console.log(rootNode);
$.index.add(rootNode);
//document.body.appendChild(rootNode);    // ... and it should be in the document

// 3: Wire up the update logic
setInterval(function () {
      // change Status
      count++;
	
	  // re-render
      var newTree = render(count);
      var patches = diff(tree, newTree);
      console.log(patches);
      rootNode = patch(rootNode, patches);
      tree = newTree;
}, 1000);<commit_msg>change test code for checking performance<commit_after>$.index.open();

var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
var count = 0;
// We need some app data. Here we just store a count.

// 1: Create a function that declares what the DOM should look like

var colors = ['aqua', 'black', 'blue', 'brown', 'cyan', 'darkgray', 'fuchsia', 'gray', 'green', 'lightgray', 'lime', 'magenta', 'maroon', 'navy', 'olive', 'orange', 'pink', 'purple', 'red', 'silver', 'teal', 'white', 'yellow'];

function render(count) {
	var cells = _.map(_.range(100), function(idx) {
		return h('View', {
			namespace : 'UI',
			style : {
				backgroundColor : colors[_.random(0, 4)], //colors[(idx + count) % colors.length],
				width : 30,
				height : 30,
				top : parseInt(idx / 10) * 30,
				left : (idx % 10) * 30
			}
		}, [
			h('Label', {
				namespace : 'UI',
				style : {
					text : idx
				}
			}, [
			
			])
		]);
	});

	return h('View', {
		namespace : 'UI',
		style : {
			borderColor : 'blue',
			// layout : 'horizontal'
		}
	}, cells);
}

// 2: Initialise the document

var tree = render(count);
// We need an initial tree
console.log(tree);

var rootNode = createElement(tree, {
	warn : console.log
});
// Create an initial root DOM node ...
console.log(rootNode);
$.index.add(rootNode);
//document.body.appendChild(rootNode);    // ... and it should be in the document

// 3: Wire up the update logic

setInterval(function() {
var newTree = render(count);
var patches = diff(tree, newTree);
rootNode = patch(rootNode, patches);
tree = newTree;
}, 50);

// setInterval(function() {
	// var newTree = render(count);
// 
	// var newRootNode = createElement(newTree, {
		// warn : console.log
	// });
// 
	// $.index.remove(rootNode);
	// $.index.add(newRootNode);
	// rootNode = newRootNode;
// 
	// tree = newTree;
// }, 50);

/*
 setInterval(function() {
 // change Status
 count++;

 // re-render
 var newTree = render(count);
 var patches = diff(tree, newTree);
 console.log(patches);
 rootNode = patch(rootNode, patches);
 tree = newTree;
 }, 1000);*/

{'fraction_non_alphanumeric': 0.16835916622127206, 'fraction_numerical': 0.012025654730090861, 'mean_word_length': 2.6059730250481694, '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': '627652', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1184, 'n_words': 335}