You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					28 lines
				
				472 B
			
		
		
			
		
	
	
					28 lines
				
				472 B
			| 
								 
											3 years ago
										 
									 | 
							
								'use strict'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const split = require('./')
							 | 
						||
| 
								 | 
							
								const bench = require('fastbench')
							 | 
						||
| 
								 | 
							
								const binarySplit = require('binary-split')
							 | 
						||
| 
								 | 
							
								const fs = require('fs')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function benchSplit (cb) {
							 | 
						||
| 
								 | 
							
								  fs.createReadStream('package.json')
							 | 
						||
| 
								 | 
							
								    .pipe(split())
							 | 
						||
| 
								 | 
							
								    .on('end', cb)
							 | 
						||
| 
								 | 
							
								    .resume()
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function benchBinarySplit (cb) {
							 | 
						||
| 
								 | 
							
								  fs.createReadStream('package.json')
							 | 
						||
| 
								 | 
							
								    .pipe(binarySplit())
							 | 
						||
| 
								 | 
							
								    .on('end', cb)
							 | 
						||
| 
								 | 
							
								    .resume()
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const run = bench([
							 | 
						||
| 
								 | 
							
								  benchSplit,
							 | 
						||
| 
								 | 
							
								  benchBinarySplit
							 | 
						||
| 
								 | 
							
								], 10000)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								run(run)
							 |