Faster vertex()
Hello,
I was adding a lot of edges on one of my graph, using vertex()
to get vertices and my code was kind of slow.
I did some benchmarking and found that a lot of time was spent inside the vertex()
function (used by my code and add_edge()
), especialy by calling get_vertex_filter
and set_vertex_filter
.
Since I wasen't using any filter, I just simplfied vertex()
to
def vertex(self, i, use_index=True):
return libcore.get_vertex(weakref.ref(self), int(i))
This is an ugly hack, but I got x4 speedup.
Would be possible to add an option to disable any *_vertex_filter
call ? Eg. if the user didn't set a filter or with an option.
I can provide a merge request if needed :)