Preload of visual search plugin stimuli effective on Chrome but not Firefox
Despite preloading and on Firefox but not Chrome, I've noticed latency for images on only their first appearance in visual search arrays.
It is especially problematic (and hilarious) in new blocks where the target is novel and there's a distinct exogenous capture effect on the first trial it's present in, as usually all of the foils have made an appearance by the end of the first block.
You can observe in context here: https://bg-stage.herokuapp.com/game/icon_vs_1/?rnid=GitHub&study=test
Are other plugins showing this difference between Firefox and Chrome in your setup? Or do you think this is specific to the visual search plugin?
Looked into this briefly; the images are being preloaded correctly, and aren't being re-requested when displayed. It's an issue with how long Firefox is taking to paint the images on the page.
I initially thought this was due to excess paints from the plugin appending a bunch of images to the DOM via innerHTML in a loop, but replacing that with a document fragment (so that we only append to the DOM once at the end of the loop) didn't really help things. I still think that might be a useful thing to do though.
The most foolproof way of avoiding this would be to paint the images on a canvas, and then display that canvas to the user. This might not fit within the timing constraints of the trials on slow hardware though.
@jodeleeuw I have suspected at times that instruction images have a tiny latency appearing, but I'm not sure how I would observe that empirically. It could be that only in the case of these visual search trials that conditions are such that the effects of the bug are striking.
@Osmose does that explain how it only affects the first appearance of each image? By the end of most blocks there's no perceivable offset between any images.
edit: fwiw, Edge appears to be affected in the same way as Firefox.
Good point about all the paint operations. That's something that I've been trying to fix in other plugins. It's a bad habit that I need to kick.
The preloading functionality isn't as reliable as I'd hoped. There are other issues -- #302, #275 -- that seem to be related to this general problem.
I've asked a couple questions on Stack Overflow to try and understand the limitations of preloading (1, 2), but haven't figured out a truly reliable way to do it.
If anyone has thoughts about a better way to do preloading I'm open to overhauling chunks of the code to improve it.