As I understand it (I am no programmer though) it's a problem of JPEG format - the compression algorithms, as I understand it, do not allow for an easy way to compress a file to a given file size, and resulting file size is a function of the image content as well (noisy detailed photos at high iso compress far worse than low iso product shot). It's a problem, that for compression to a given file size, the program would have to really compress the file many times, picking the best result out of all of them, for every file to be compressed. You can see that could take a very looong time for even few dozens files... If there is a better way with JPEG, nobody discovered it yet.
JPEG2000, another compression format, unrelated in its mathematics to JPEG, allows for precise compression to a given file size, unfortunately, it has never been widely adopted by the industry (as it has other significant disadvantages for camera use).