Speed is the larger concern, but a description of accuracy would be appreciated as well.
Autofocus is a system. There is no single part that is particularly responsible for making an AF system perform well or achieve high accuracy. In modern cameras, components and software that support AF are found in both the lens and the camera body. In some cameras that are still based on legacy AF systems, these components may be inferior, even significantly inferior, to modern fully electronic AF systems.
From a general standpoint, electronic autofocus systems where the motor is housed in the lens provide the greatest performance and highest accuracy. However an AF lens with a focus motor is only part of the picture...you still need a something to drive that motor and make it do its thing. There are also different kinds of motors, some are cheaper and less effective while others are more expensive and more effective. In addition to mechanical and electrical components, you also need appropriate software...firmware, to operate an AF system. In a modern electronic AF system, firmware usually exists in both the lens and the camera body. In older systems, firmware will likely only exist in the camera body (potentially along with the AF drive motor, as some older designs included the motor in the camera body rather than in the lens.)
Autofocus in the past used to be achieved with partial open-loop feedback systems, where the camera would initiate an AF drive movement, the lens would adjust, and the system would stop until you told it to perform another AF adjustment. Depending on the exact implementations, more than one lens movement may have occurred in response to a single AF command. This may have been due to limited or no firmware in the lens, preventing a proper feedback loop.
In modern AF systems, AF drive is achieved with closed-loop feedback systems. With a closed loop, AF adjustments are continuously performed until focus is achieved...at least to within certain tolerances. This is possible due to much richer firmware housed in autofocus lenses, allowing more complete two-way communication between the lens and the camera. The camera instructs the lens to make a certain move, and the lens can provide information about whether it made the requested move, and whether the move was by the requested amount, or not. The camera and lens can continually make adjustments in response to a single AF command from the user to achieve a more accurate focus.
Such closed-loop feedback is a more recent advent in AF systems, supported by newer lens technology, more advanced AF drive software in camera bodies, and more accurate phase-shift detection sensors. AF speed and accuracy are increasingly dependent upon AF sensor capabilities, the number of AF sensor points, the capabilities of AF drive software, and the speed of in-camera processors.
When it comes to accuracy, there are several specific factors that play a role. The AF sensor is probably the most significant factor, however the firmware in the lens as well as the optical quality of the lens also count. Metering systems, particularly color metering systems, are also becoming tied into the AF system of modern cameras, offering increased capabilities not previously possible, or only possible on very high-end cameras. There are a wide variety of AF sensors on the market in current DSLR cameras, from basic 9-point sensors with a single high precision point to 61-point sensor with 41 high precision points, and a variety of options in between. The size of each AF point, their density, the orientation of phase-detect sensor lines, and even how sensor lines converge all affect the precision and accuracy of an AF system.
Naturally, the more complex the AF sensor is and the higher the number of AF points, the more complex the software that drives it must be. In modern "reticular" (net-like) AF systems, where there are a high number of points, as well as a high number of high precision points, the AF drive software is generally pretty advanced. A color metering sensor, either Olive/Teal (Red-Green and Blue-Green) or full RGB, may be involved in AF system decisions, allowing subject color, shape, and even identification based on libraries of known subjects can be used to assist in the selection of which AF points to use when determining focus.
The precision of an AF point depends on its structure. There are single line points, both horizontal and vertical sensors, cross type points, which involve both horizontal and vertical line sensors in a single AF point, and diagonal cross type points which involve two 45 degree line sensors in opposition to each other for a single AF point, and double cross type points that utilize both a standard and diagonal cross type set of sensors at a single AF point. The more line sensors, of any orientation, involved in the detection of phase-shift at a single AF point will increase the precision of focus detected by that point.
The design of each sensor also varies. Some line sensors are extremely high precision as they include more photodiodes per line, allowing phase shift to be detected in finer increments, yet requiring more light to do so. Others are lower precision as they use fewer photodiodes per line, sensing more light per sensor, therefor operating in lower overall light. Some AF points will only operate up to certain maximum apertures. The highest precision points tend to require f/2.8, and there are usually fewer points in an AF system that are this precise. Most AF points will require at least f/4 or f/5.6, operating in less light but also offering less precision. Some advanced AF systems support one or more AF points that will operate with lenses that have an f/8 maximum aperture (such as an f/5.6 lens with a 1.4x TC or an f/4 lens with a 2x TC). Most modern multipoint AF systems have f/2.8, f/4, and f/5.6 AF points, and a few include one or more f/8 AF points.
When it comes to the speed of an AF system, this really boils down to two things: Light and processing performance. In almost all cases, the more light you get down the lens, the faster AF will be. This is due to the fact that an AF unit, a small package below the DSLR mirror that houses the AF sensor, utilizes only a fraction of the light that actually passes through the aperture. The mirror itself is half-silvered, and will allow about 50% of the light that reaches it through to a secondary mirror, which will reflect that 50% of light onto the AF unit. Further, only the area of the frame covered by AF points is actually half-silvered in the main mirror, so only a fraction of the total amount of light is involved in the first place...so were working with less than 50% of the total amount of light passing through the lens aperture. Furthermore, a special lens on top of the AF unit above the sensor is responsible for further dividing the light that reaches it. The light reaching the AF unit will be split by as many AF points, and for each AF point, light will be split again to reach the two, four, or even eight halves of each line sensor responsible for detecting phase shift for each AF point. An AF sensor has to work with less than 50% of the light passing through the lens, and each AF point works with a fraction of that light.
Assuming you have enough light to use the highest precision AF points, the key factor in performance is the efficiency of the AF drive software and the speed of the processor that executes it. An efficient algorithm operating on a fast processor, paired with a high quality lens that also includes a fast processor and efficient algorithms in its own firmware, will produce some of the best AF performance. In the case of the Canon 1D X, the AF and Metering system actually has a dedicated processor that is independent of the core image processors (a unique setup), providing continuous AF with uninterrupted processing power. High performance computing allows an AF system, both lens and camera, to perform closed-loop AF fine tuning several times in a fraction of a second, supporting extremely high precision, high accuracy continuous AF to be performed anywhere from 6 to 14 times per second.
That's a complex question because there are multiple ways of doing AF that span the body and lens, and the whole thing works together as a system. It depends on what mechanism is used to move the optics around.
Screw-driven focus speed depends partially on how fast the body can turn the cam that drives the lens and partially how much weight and friction there is in the focus mechanism of the lens. (On a side note, that's one of the reasons screw-driven AF lenses tend to feel "cheap" compared to older, manual lenses: they need to have low weight and friction so they'll focus quickly without forcing the motor to work harder. The drag that helps a human hand make fine adjustments isn't desirable when the lens is being turned by the body.)
In-lens motors tend to be faster (and quieter) than screw-driven AF, so how fast focusing happens depends almost entirely on the lens, which is just acting on commands from the body and perhaps providing feedback about how things went. The condition of the power source in the body may play some small role depending on how the body manages its power.
Accuracy is a function of how well the body can make decisions about how well the image is focused, how finely it can control the focus mechanism and how well the mechanism holds its position when not being moved.
Comparing some of Minolta's first generation AF lenses on a first generation Maxxum 9000 body (pretty much the first real AF SLRs1) to a reasonably current (Sony Alpha A900) body indicates that even with exactly the same lenses, a new body improves speed dramatically, while a new lens on an old body improves speed only slightly (if at all). I haven't measured this objectively, but subjectively, I'd say old body with new lens gives, maybe, a 20-30% improvement, while old lens with new body is probably at least 5x faster.
I'd add that the speed improvement has been extremely non-linear over that time though. I also have a Maxxum 9 from 1998 or '99, which is pretty much on a par with the A900 -- if anything, it seems like it's marginally faster, though I'm not really sure of that.
I should add that age of lenses doesn't make a lot of difference in speed, but there can be (are) pretty substantial differences within lenses of exactly the same age. Just for example, I have a number of first-generation Minolta AF lenses -- 28, 35, 50, 135 and 28-135. The 135, for one example, focuses really fast. I also have an 85/1.4 that's much newer -- but the 135 still focuses quite a lot faster.
At least for still photography, accuracy depends primarily on the body. If focusing was done open-loop, then inaccuracy between the distance a lens was told to move, and the distance it actually moved would lead to focusing inaccuracy. Contrary to popular belief, I'm reasonably certain open loop focusing has never been the norm, nor probably used at all (e.g., Minolta's 1982 patent discloses a closed-loop system). Given that it is closed loop, more accurate lens movement mostly means less tweaking to get accurate focus.
On a slightly different subject, I'd note that with f/2.8 vs. f/4, f/5.6 (etc.) sensors, the real issue isn't the amount of light being used in most cases. The real issue is primarily the diameter of the lens (expressed as an angle) seen by the sensor. To explain that, I probably need to back up and explain a bit about how an AF sensor works in the first place. For the moment, let's stick to a simple single-line sensor. This starts with two prisms, much like the split-image at the center of most manual focus cameras' screens. Behind each prism is a line sensor. Much like with a split-image viewfinder, the camera finds focus by aligning the images coming through those two prisms.
The basic difference between an f/2.8 sensor and (for example) an f/5.6 sensor is the angle of those prisms. That determines the angle between two streams of that get "looked at" by the focus sensor. The wider the angle between the light being captured by the two prisms, the more misalignment there will be between the pictures captured by those two sensors for a given degree of mis-focus. This, in turn, makes it easier for the camera to determine the degree of mis-focus, and determine final focus more accurately.
Main point though: it's not about the amount of light, but about the angle of the light. An f/2.8 sensor indoors will still (easily) beat an f/5.6 sensor in full sunlight, even though the latter has more light to work with. Likewise, having a lens faster than the sensor's rating (e.g., f/1.4 lens, f/2.8 sensor) gives essentially no improvement at all.
As far as speed differences between having the motor in the body vs. the lens goes, I'm afraid I have to contradict the common knowledge yet again. Just for example, Minolta made 300/2.8 lenses in both both body-driven and in-lens (SSM) versions. The SSM version is (as expected) virtually silent, and "feels" like it's focusing faster -- but here I have done some objective measurements, and it turns out the SSM version is marginally slower than its mechanically-driven predecessor. By the time it came out, however, it no longer really mattered much -- mechanically driven lenses were "fast enough".
I should add, however, that for following focus, SSM/HSM/USM lenses seem to have an edge. I suspect this has less to do with focus speed than accuracy of movement. In an SLR, there's typically about an 80-100ms delay while the mirror flips up before the picture gets taken. The AF system looks at focus movement, and predicts where it will be when the shutter actually opens. Unlike normal AF, however, there's no question that this has to be done "open loop" -- as soon as the mirror starts to flip up, the AF sensor no longer receives any light, so it can't sense anything. So, for that duration, the AF system just continues moving the lens' focus with no way of checking how closely that movement reflects what it's asking to have happen.
Though I can't find a link to it right now, one site did a test a few years ago. As I recall, they mounted a target on a car and drove toward the camera, taking pictures until the car passed the camera.
Depending on how you want to interpret the results, you could read the results from that as favoring either Sony or Canon. The Sony A700 produced the highest percentage of in-focus pictures, but the then-current Canon 1D (I think the mark IV) produced a greater number of in-focus pictures, thanks to a higher frame rate.
- At least with the early AF systems that were really slow, the body makes the big difference. 1a. But most of that difference happened over a decade ago.
- For f/2.8 vs. f/5.6 (etc.) sensors, it's really the f/stop that matters, not the amount of light.
- Differences between body-driven and lens-driven focus were once huge, but now minimal -- to the point that it's pretty much lens-by-lens not one class vs. another class. 3a. but for following focus, in-lens motors still have a major advantage.
Though I don't shoot video, I'd guess that it's enough like predictive focus that 3a probably applies to video as well.
There were a few attempts before this -- for a couple of examples, the Nikon F3AF and a Pentax whose model number I don't remember. Neither sold enough to notice. From a purely technical viewpoint, neither could honestly be considered any more than a proof of concept -- if you had enough patience, you could point them at something and find they would indeed find the correct focus point -- eventually. I, however, would rate both as completely impractical. Focusing was far too slow to be useful, and lens selection so limited it hardly mattered anyway -- Pentax had only one AF lens, and Nikon two.
Speaking for Canon equipment: The speed is primarily dictated by the lens, the accuracy by the body. However, the accuracy will also in part depend on the precision of the lens motor.
Basically the lens and the body work as a closed loop system. The computer in the body decides on the current state of focus. This information is gathered via its sensors. Number and type vary by body. For example low end models have one cross type sensor in the center and 8 other point type sensors. The computer then sends a request to the lens to rotate the focusing element over a 8-data-bit, 1-stop-bit SPI protocol.
Now the micro-controller on the lens takes a call on how long to run the motor to reach the requested position. This itself is an open loop system whose speed and accuracy solely depends on the lens. This is a open-loop process and the lens has no positional feedback at all. It simply turns as much as it thinks it should. This is where the precision of the lens motor comes into play. Once the requested position is attained the body checks for focus again. If satisfied with the focus, it sends an indication to the user or requests a correction on the position.
However in practice, the precision of the motor will not really affect focus accuracy. Age of the cross point sensors and dust will probably be a much bigger factor.