<commit_before>
// Modules
	var net = require('net');

// Export Module
	module.exports = function(){

		// Variables
		var clientId   = 0;
		var clientKeys = [];
		var client     = {};
		var round      = -1;
		var counter    = 0;
		var operations = {};
		var result     = {};

		// Local functions
		var addServer = function( port ){

			net.Socket()
			   .connect( port )
			   .on( 'connect', connectedServer )
			   .on( 'data', doOperations )
			   .on( 'error', noop )
			   .on( 'close', function(){

			   		delete client[ this.hermodId ];

			   		this.cache = '';

					clientKeys = Object.keys( client );

					this.connect( port );

			   });

		};

		var connectedServer = function(){

			this.setNoDelay( true );

			this.hermodId           = clientId++;
			this.cache              = '';
			client[ this.hermodId ] = this;
			clientKeys              = Object.keys( client );

		};

		var doOperations = function( data ){

			this.cache += data;

			while( data = getOperationFromCache.call( this ) ){
				executeOperation( data );
			}

		};

		var getOperationFromCache = function(){

				var origin = this.cache;

				var cut = this.cache.indexOf('#');

				if( cut === -1 ){
					return null;
				}

				var size   = this.cache.slice( 0, cut );
				var length = parseInt( size, 10 );

				if( this.cache.length - size.length - 1 < length ){
					return null;
				}

				this.cache = this.cache.slice( cut + 1 );

				var data = this.cache.slice( 0, length );

				this.cache = this.cache.slice( length );

				return JSON.parse( data );

			};

		var executeOperation = function( data ){
			
			var cbId = data.shift();

			if( operations[ cbId ] ){

				operations[ cbId ].apply( null, data );

				delete operations[ cbId ];

			}

		};

		var getClient = function( callback ){
<commit_msg>Optimization<commit_after>
// Modules
	var net = require('net');

// Export Module
	module.exports = function(){

		// Variables
		var clientId   = 0;
		var clientKeys = [];
		var client     = {};
		var round      = -1;
		var counter    = 0;
		var operations = {};
		var result     = {};

		// Local functions
		var addServer = function( port ){

			net.Socket()
			   .connect( port )
			   .on( 'connect', connectedServer )
			   .on( 'data', doOperations )
			   .on( 'error', noop )
			   .on( 'close', function(){

			   		delete client[ this.hermodId ];

			   		this.cache = '';

					clientKeys = Object.keys( client );

					this.connect( port );

			   });

		};

		var connectedServer = function(){

			this.setNoDelay( true );

			this.hermodId           = clientId++;
			this.cache              = '';
			client[ this.hermodId ] = this;
			clientKeys              = Object.keys( client );

		};

		var doOperations = function( data ){

			this.cache += data;

			while( data = getOperationFromCache.call( this ) ){
				executeOperation( data );
			}

		};

		var getOperationFromCache = function(){

				var origin = this.cache;

				var cut = this.cache.indexOf('#');

				if( cut === -1 ){
					return null;
				}

				var size   = this.cache.slice( 0, cut );
				var length = parseInt( size, 10 );

				if( this.cache.length - size.length - 1 < length ){
					return null;
				}

				this.cache = this.cache.slice( cut + 1 );

				var data = this.cache.slice( 0, length );

				this.cache = this.cache.slice( length );

				return JSON.parse( data );

			};

		var executeOperation = function( data ){
			
			var cbId = data.shift();

			if( operations[ cbId ] ){

				process.nextTick( function(){

					operations[ cbId ].apply( null, data );
					
					delete operations[ cbId ];

				});

			}

		};

		var getClient = function( callback ){

{'fraction_non_alphanumeric': 0.1449591280653951, 'fraction_numerical': 0.005449591280653951, 'mean_word_length': 2.0439469320066337, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1491226', 'n_tokens_mistral': 1486, 'n_tokens_neox': 1120, 'n_words': 304}