Slightly more efficient getDestination
				
					
				
			For named destinations that are contained in a `Dict`, as opposed to a `NameTree`, we currently iterate through the *entire* dictionary just to fetch *one* destination. This code appears to simply have been copy-pasted from the `get destinations` method, but in its current form it's quite unnecessary/inefficient since can just get the required destination directly instead.
This commit is contained in:
		
							parent
							
								
									940bedf75f
								
							
						
					
					
						commit
						7df78f997e
					
				@ -493,17 +493,11 @@ var Catalog = (function CatalogClosure() {
 | 
				
			|||||||
        nameDictionaryRef = this.catDict.get('Dests');
 | 
					        nameDictionaryRef = this.catDict.get('Dests');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (nameDictionaryRef) {
 | 
					      if (nameDictionaryRef) { // Simple destination dictionary.
 | 
				
			||||||
        // reading simple destination dictionary
 | 
					        var value = nameDictionaryRef.get(destinationId);
 | 
				
			||||||
        obj = nameDictionaryRef;
 | 
					        if (value) {
 | 
				
			||||||
        obj.forEach(function catalogForEach(key, value) {
 | 
					          dest = fetchDestination(value);
 | 
				
			||||||
          if (!value) {
 | 
					        }
 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          if (key === destinationId) {
 | 
					 | 
				
			||||||
            dest = fetchDestination(value);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (nameTreeRef) {
 | 
					      if (nameTreeRef) {
 | 
				
			||||||
        var nameTree = new NameTree(nameTreeRef, xref);
 | 
					        var nameTree = new NameTree(nameTreeRef, xref);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user