mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	measuring how much time does autocomplete building takes
This commit is contained in:
		
							parent
							
								
									9901882a0f
								
							
						
					
					
						commit
						a10269a086
					
				| @ -16,7 +16,7 @@ const jumpToNote = (function() { | |||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         await autoCompleteEl.autocomplete({ |         await autoCompleteEl.autocomplete({ | ||||||
|             source: noteTree.getAutocompleteItems(), |             source: await stopWatch("building autocomplete", noteTree.getAutocompleteItems), | ||||||
|             minLength: 0 |             minLength: 0 | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| @ -26,11 +26,6 @@ const jumpToNote = (function() { | |||||||
|         return link.getNodePathFromLabel(val); |         return link.getNodePathFromLabel(val); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function getSelectedNoteId() { |  | ||||||
|         const notePath = getSelectedNotePath(); |  | ||||||
|         return treeUtils.getNoteIdFromNotePath(notePath); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     function goToNote() { |     function goToNote() { | ||||||
|         const notePath = getSelectedNotePath(); |         const notePath = getSelectedNotePath(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -98,3 +98,15 @@ function isRootNode(node) { | |||||||
| function escapeHtml(str) { | function escapeHtml(str) { | ||||||
|     return $('<div/>').text(str).html(); |     return $('<div/>').text(str).html(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | async function stopWatch(what, func) { | ||||||
|  |     const start = new Date(); | ||||||
|  | 
 | ||||||
|  |     const ret = await func(); | ||||||
|  | 
 | ||||||
|  |     const tookMs = new Date().getTime() - start.getTime(); | ||||||
|  | 
 | ||||||
|  |     console.log(`${what} took ${tookMs}ms`); | ||||||
|  | 
 | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
| @ -102,11 +102,13 @@ function assertArguments() { | |||||||
| async function stopWatch(what, func) { | async function stopWatch(what, func) { | ||||||
|     const start = new Date(); |     const start = new Date(); | ||||||
| 
 | 
 | ||||||
|     await func(); |     const ret = await func(); | ||||||
| 
 | 
 | ||||||
|     const tookMs = new Date().getTime() - start.getTime(); |     const tookMs = new Date().getTime() - start.getTime(); | ||||||
| 
 | 
 | ||||||
|     console.log(`${what} took ${tookMs}ms`); |     console.log(`${what} took ${tookMs}ms`); | ||||||
|  | 
 | ||||||
|  |     return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner