I am working on a project where I've discovered via profiling that the performance hot spot is a function that looks like:
oneline[g_, tweight_,
lweight_] := {RGBColor[g[[1]], g[[2]], g[[3]], g[[4]]],
Thickness[tweight*g[[5]]],
Line[{lweight*g[[6 ;; 7]], lweight*g[[8 ;; 9]]}]};
render[i_]:=Image[Graphics[oneline[#, 0.5, 200] & /@ i]] //
ImageResize[#, {200, 200}] &
Basically, I have a set of colored lines that I'm rendering into a Graphics[] object that I then render to a 200x200 Image that I later extract pixel data from with ImageData. In my tests, I'm creating around 100 images each with 80 lines - which takes around 6.3 seconds (measured w/ AbsoluteTiming) on my 2018 macbook pro w/ Mathematica 11.3. Given that it works out to drawing 8000 lines and creating only 100 images that are 200x200, I was expecting this to run much faster.
Is there a better way to create 2D Images from Graphics objects built out of graphics primitives that will run faster?