mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	faster content hash computation via in memory sorting
This commit is contained in:
		
							parent
							
								
									a9a9edf658
								
							
						
					
					
						commit
						620e896a89
					
				| @ -12,9 +12,11 @@ const RecentNote = require('../entities/recent_note'); | |||||||
| const Option = require('../entities/option'); | const Option = require('../entities/option'); | ||||||
| 
 | 
 | ||||||
| function getSectorHashes(tableName, primaryKeyName, whereBranch) { | function getSectorHashes(tableName, primaryKeyName, whereBranch) { | ||||||
|     const hashes = sql.getRows(`SELECT ${primaryKeyName} AS id, hash FROM ${tableName} ` |     const hashes = sql.getRows(`SELECT ${primaryKeyName} AS id, hash FROM ${tableName}` | ||||||
|         + (whereBranch ? `WHERE ${whereBranch} ` : '') |         + (whereBranch ? ` WHERE ${whereBranch} ` : '')); | ||||||
|         + ` ORDER BY ${primaryKeyName}`); | 
 | ||||||
|  |     // sorting is faster in memory
 | ||||||
|  |     hashes.sort((a, b) => a.id < b.id ? -1 : 1); | ||||||
| 
 | 
 | ||||||
|     const map = {}; |     const map = {}; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam