There is actually a much more faster solution that’s simpler. It’s the map command. With map approach, this is the speed:
C:\Windows\System32>gmic sp dog tic new_rep_bitplane_shuffle 8,${rep_extract_permutation_order\ 8,23459} toc
[gmic]-0./ Start G'MIC interpreter.
[gmic]-1./ Input sample image 'dog' (1 image 1024x685x1x3).
[gmic]-1./ Initialize timer.
[gmic]-1./ Elapsed time: 0.002 s.
[gmic]-1./ Display image [0] = 'dog'.
[0] = 'dog':
size = (1024,685,1,3) [8 Mio of float32].
data = (208,216,208,216,208,216,216,208,208,216,216,208,(...),220,85,85,85,220,220,73,73,73,220,220,220).
min = 1, max = 254, mean = 124.926, std = 70.271, coords_min = (405,181,0,1), coords_max = (496,88,0,2).
[gmic]-1./ End G'MIC interpreter.