I'm not sure what "learn by heart" and "index" mean in this context. Does anyone actually have the ability to control whether they memorize something versus just "indexing" it? How would we measure "efficiency" of learning?
I learn mainly by doing, and I remember things important to me, and things I've done repeatedly.
I first fast read through the topic to learn to kind of get the pillars and terminology down. And then I deepen the topic I need to know. My reasoning is that first skimming though all topics helps me to get the idea which toolings and concepts I can use as the best/optimal solution for a particular problem I want to solve instead of only seeing parts of the concepts and using only the parts to solve the problem at hand.
Either approach boils down to apply the concepts and learn them by applying the concepts. You could just distinguish my 2 approaches that I prefer to lean on reading more beforehand and not jumping straight to solving the problem