What happens if you call it from within perl without looking up values (i.e., try it hard-coded)? This would at least answer the question of whether the problem arises from calling it in perl or from some artifact related to the way you are putting the call together. Also, are you sure that it is solely this call that is slowing things down and not other stuff going on before/after?