The algorithm used was very, very poorly designed. Now when setting the profile flag to 1 gives the
following. Before in one test:
11168736 function calls (10986641 primitive calls) in 76.750 CPU seconds
ncalls tottime percall cumtime percall filename:lineno(function)
758954 12.160 0.000 51.060 0.000 /home/edau/relax/relax-1.3/generic_fns/relax_re.py:31(search)
141 0.890 0.006 67.620 0.480 /home/edau/relax/relax-1.3/generic_fns/structure/internal.py:444(bond_vectors)
All other function call info lines have been removed. After the changes:
2586419 function calls (2579305 primitive calls) in 21.370 CPU seconds
ncalls tottime percall cumtime percall filename:lineno(function)
62803 1.180 0.000 5.020 0.000 /home/edau/relax/relax-1.3/generic_fns/relax_re.py:31(search)
141 0.060 0.000 12.020 0.085 /home/edau/relax/relax-1.3/generic_fns/structure/internal.py:444(bond_vectors)
The difference is that the selection object is no longer used, as it is completely unnecessary.