Taking it down to assembly or machine code there are a few extra instructions when calling a function or sub which will slow things down a bit when there's a lot of pixel writing and reading.
One thing that can be done (there's a lot more that can be done though) is to use #define, it's just the same as writing the code inline (as opposed to using subs/funcs) but a little neater.
#define writepixel(x,y,argb) screen_buffer(x+y*wwidth)=argb
#define readpixel(x,y) screen_buffer(x+y*wwidth)
dim shared as integer wwidth,height
wwidth=640
height=480
dim shared screen_buffer(0 to wwidth*height-1) as integer
sub main
 Â
  writepixel(100,100,&hff00ff)
 Â
  print hex$(readpixel(100,100))
 Â
end sub
main
sleep
instead of calling the function each time the code will be inserted from the #define
EDIT: and you'll need to add tiny_ptc to actually see anything.