The speed of a ball starting from $A$ at rest and going to $B$ without friction is fixed by the difference in height between $A$ and $B$. In particular, if the ball has mass $m$, and we take $A$ to be at zero height, while $B$ is at height $h$, then by conservation of energy:
$$0+mgh=\frac{1}{2}mv^2+0 \implies v=\sqrt{2gh}$$
If we take into account the fact that the ball has a size and is rolling, as long as friction is negligible (that is, the ball rolls without slipping), then the result is numerically slightly different, but still independent of the path taken (again, by conservation of energy).
Notice that the velocity is parallel to the path, so the direction of the final velocity is determined only by the shape of the final part of the path.
If you are trying to maximise velocity, then you should place $A$ and $B$ as far away as possible in height. At fixed $A$ and $B$, if we ignore friction the final speed, is determined as explained above. Therefore what you should be doing in practice is trying to minimise friction - but that's an engineering issue on which I can offer little help.