I'm looking into various file formats and how they are optimized for their main purposes, but I've found that the GIF file format uses lossless compression meaning it would have a higher file size which wouldn't be desirable for its common use online so I was wondering if the GIF file format removed data which is shared between frames like a common background in order to reduce the file size and still have decent image quality.
If it doesn't could you explain why the GIF file format doesn't use lossy compression or doesn't share data between frames because it is generally used online where low storage space is really needed?