mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									b131edd95c
								
							
						
					
					
						commit
						ee57d68922
					
				| @ -611,11 +611,9 @@ function populateSparceGIDList(gids, target, data){ | |||||||
| // Remove all the undefined's form a sparse list...
 | // Remove all the undefined's form a sparse list...
 | ||||||
| //
 | //
 | ||||||
| function compactSparceList(lst){ | function compactSparceList(lst){ | ||||||
| 	// XXX is it normal that .filter(..) skips undefined values?
 | 	// NOTE: JS arrays are sparse, so all the iterators will return only
 | ||||||
|  | 	// 		the actually existing items...
 | ||||||
| 	return lst.filter(function(){ return true }) | 	return lst.filter(function(){ return true }) | ||||||
| 	//return lst.filter(function(e){
 |  | ||||||
| 	//	return e !== undefined
 |  | ||||||
| 	//})
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -647,8 +645,6 @@ function compactSparceList(lst){ | |||||||
| //		console.log('T:', Date.now()-t0)
 | //		console.log('T:', Date.now()-t0)
 | ||||||
| //		>>> T: 171
 | //		>>> T: 171
 | ||||||
| //
 | //
 | ||||||
| // On the down side, this has some memory overhead -- ~ N - n * ref
 |  | ||||||
| //
 |  | ||||||
| function fastSortGIDsByOrder(gids, data){ | function fastSortGIDsByOrder(gids, data){ | ||||||
| 	return compactSparceList(populateSparceGIDList(gids, data)) | 	return compactSparceList(populateSparceGIDList(gids, data)) | ||||||
| } | } | ||||||
|  | |||||||
| @ -16,7 +16,6 @@ | |||||||
| // 			- trivial sorting
 | // 			- trivial sorting
 | ||||||
| // 			- less maintenance and sync
 | // 			- less maintenance and sync
 | ||||||
| // 		The tradeoff being:
 | // 		The tradeoff being:
 | ||||||
| // 			- more memory usage
 |  | ||||||
| // 			- load/save conversion to keep the json	data "packed".
 | // 			- load/save conversion to keep the json	data "packed".
 | ||||||
| // NOTE: it would appear that JS is designed with sparse lists in mind:
 | // NOTE: it would appear that JS is designed with sparse lists in mind:
 | ||||||
| // 		- all iterators (map, filter, forEach, ..) skip undefined values
 | // 		- all iterators (map, filter, forEach, ..) skip undefined values
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user