Selaa lähdekoodia

Fixed some minor bugs and performance issues in entry ID retrieval

Yentl Van Tendeloo 7 vuotta sitten
vanhempi
commit
51e4aa89d2
3 muutettua tiedostoa jossa 11 lisäystä ja 13 poistoa
  1. BIN
      bootstrap/bootstrap.m.gz
  2. 11 13
      bootstrap/core_algorithm.alc
  3. BIN
      bootstrap/minimal.m.gz

BIN
bootstrap/bootstrap.m.gz


+ 11 - 13
bootstrap/core_algorithm.alc

@@ -33,10 +33,10 @@ String function get_foldername(name : String):
 
 	// 'result' now contains a list of entries which we have to join with the seperator
 	String str
-	str = list_pop(result, 0)
+	str = list_pop_final(result)
 
 	while (list_len(result) > 0):
-		str = string_join(str + "/", list_pop(result, 0))
+		str = cast_string(list_pop_final(result)) + "/" + str
 
 	return str!
 
@@ -259,9 +259,9 @@ String function get_entry_id(name : String):
 	String current
 	Integer i
 	Element elems
-	String current_part
 	String elem
 	Boolean found
+	String folder_name
 
 	if (name == ""):
 		return caches["root"]!
@@ -271,20 +271,18 @@ String function get_entry_id(name : String):
 			if (full_name(caches["models"][name]) == name):
 				return caches["models"][name]!
 
-	current = get_entry_id(get_foldername(name))
+	folder_name = get_foldername(name)
+	current = get_entry_id(folder_name)
 
 	if (current == ""):
 		return ""!
 
-	if (current_part != ""):
-		elems = allAssociationDestinations(core, current, "contains")
-		while (set_len(elems) > 0):
-			elem = set_pop(elems)
-			dict_overwrite(caches["models"], read_attribute(core, elem, "name"), elem)
-			if (value_eq(name, read_attribute(core, elem, "name"))):
-				return elem!
-	else:
-		return current!
+	elems = allAssociationDestinations(core, current, "contains")
+	while (set_len(elems) > 0):
+		elem = set_pop(elems)
+		dict_overwrite(caches["models"], read_attribute(core, elem, "name"), elem)
+		if (value_eq(name, read_attribute(core, elem, "name"))):
+			return elem!
 
 	return ""!
 

BIN
bootstrap/minimal.m.gz