Currently for merging vertices, the BM_vert_splice and` BM_edge_collapse` functions are used.
However, these functions do not deal with duplicate faces and do not work to collapse faces in the middle (creating two faces) or to join vertices of different faces.
The weld_verts operator solves this problem by checking all faces that share a pair of vertices and split them.
It also creates edges for cases where different face vertices are used.
The new function BM_vert_splice_collapse solves all these different cases efficiently.
To test it the weld_verts operator has been redone.
Here are the results for the performance test on a Suzanne subdivided 2x:
(t1: original weld_verts | t2: new weld_verts)
Merge all suzanne verts with loose verts:
t1: 0.001805; t2: 0.000304; fac: 5.9375
Duplicate and merge all suzanne verts:
t1: 0.008582; t2: 0.005968; fac: 1.438002
Merge single suzanne vert:
t1: 0.001548; t2: 0.000007; fac: 176,571428
Move out suzanne:
t1: 0.001236; t2: 0.000004; fac: 325.213034