have you noticed that commands like:
var myCh = activeDocument.channels.name;
are sometimes _extremely_ slow.
It seems that every time the channels object is accessed it prepares the Histogram and the larger the image is the more slow the operation is.
So, when I first make a 1x1 pixel selection and then access the channels object it is very fast no matter what the image size is.