Skip to content
Snippets Groups Projects
Commit 13720232 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Faster generation of next_id

parent efe930d1
No related branches found
No related tags found
1 merge request!464Faster generation of next_id
Pipeline #155577 passed
...@@ -68,7 +68,6 @@ class GraphIDGenerator: ...@@ -68,7 +68,6 @@ class GraphIDGenerator:
def next_id(self, type_name: TypeName, used_ids: MutableSet = set()) -> GraphID: def next_id(self, type_name: TypeName, used_ids: MutableSet = set()) -> GraphID:
"""Get the next graph id for a certain graph id type.""" """Get the next graph id for a certain graph id type."""
new_id = type_name + str(self._next_id_number[type_name]) new_id = type_name + str(self._next_id_number[type_name])
self._next_id_number[type_name] = 0
while new_id in used_ids: while new_id in used_ids:
self._next_id_number[type_name] += 1 self._next_id_number[type_name] += 1
new_id = type_name + str(self._next_id_number[type_name]) new_id = type_name + str(self._next_id_number[type_name])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment