How much energy is required to compress the O2 or H2 for storage/transport or even use?
Pure O2 or H2 at atmospheric pressure isn't that useful. For example, it is very hard to use atmospheric pressure H2 to run an internal combustion engine.
It's easier to run an external combustion engine with atmospheric pressure H2, but said engine will have to be right on top of the H2 generator and since the engine needs a cooling source and the H2 generator requires sunlight, you may have enough of a temperature differential to run a heat engine directly, without the H2 intermediary.
Just to transfer solar energy to hydrogen, but there will be additional loss when converting to electricity, so it's way less efficient than conventional solar cells.
High end photovoltaic solar cells are over 40% efficiency for a while. Consumer solar cells are a little over 10% but comparing the best sample in lab conditions with a consumer level product is somewhat misleading.