Guitar is very visual-pattern oriented, since our same-octave notes can occur in multiple places, unlike a keyboard where there is only one note named A=440. Earlier, I spent a whole thread trying to get guitarists here to see this, but most were resistant.
Scale shapes are relevant only physically, in relation to fingering. In themselves, as melodic entities, scales are not useful like “riffs” are. Riffs are constructed melodies, with rhythmic identity. Scales are not; they are just an index of notes.
Don’t practice scales for speed; practice riffs for speed. Memorize scale fingerings and shapes; that’s all they’re good for.
Additionally, I want to debunk the notion that “you have to know every note name anywhere on the fingerboard.” Note-naming is most useful on the 5th and 6th strings, for building chords in a key.
But note-naming can be replaced by relative pitch recognition within a key. If you are playing over a G7, you can know by ear what all the scale members are: root, major or minor third, fifth, seventh, etc. This is called “playing by ear” and usually the people who do it don’t think about it; they just hear it.
Also, with visual pattern recognition, riffs can be oriented by using existing patterns you already know. Example, you can use your pentatonic pattern to locate a jazz riff, by knowing something like "The riff begins on the fourth string, second finger (which is already memorized with the riff) on the fret just behind the tonic note on the second string in the “pentatonic extension” which I call “the B.B. King note.”
In this case, it is necessary to locate that “tonic reference note” very quickly, but not necessarily by note-name. You can be using visual pattern recognition for location, or even “pure ear” recognition.
If this location process is happening through very fast chord changes, It might be better to simply memorize what fret the riff starts on and “pre-plan” your solo to that degree.