I tried it without the 8 footies and got
var troops = new Array(960, 960, 960, 960, 960, 900, 900, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,350, 350, 350, 350, 350);
Barracks 1 = 960,960,350,350,350,50,50 = 51:10
Barracks 2 = 960,960,350,350,50,50,50,50,50,50,50,50,50 = 51:10
Barracks 3 = 960,900,900,50,50,50,50,50,50,50 = 51:50
Maybe too early and not enough coffee yet but with the fastest unit being 50 secs and the difference between 51:50 and 51:10 being 40 secs, struggling to see where to improve it.
Frequently the BHG version has 2 barracks finished and still a howitzer and 10 rifles queued in the remaining one.
If it was my game, I'd have simply just divided the total time by number of working barracks, so a single howitzer would be 320 in each barrack