In a C UDF, looping on a [:oid,:str:] bat, I'm tokenizing each string tail into a str array:

BATloop(..) {
  str *token_array = /* create a str array by tokenizing the str tail of this BUN */
  
  /* append a histogram of token_array to result */
}

The token array is expected to be in the range of 10 - 10K short strings (1 to 10 bytes).

Question:
To get the histogram, I'd turn the token_array into a BAT b, then use BATgroup:

BATgroup(&gn, NULL, &hn, b, NULL, NULL, NULL);


Do you see a more efficient way? Is there a group/histogram primitive implemented that works directly on arrays rather than BATs? 

Thanks, Roberto