Imagine cannabis growing in the wild in Central Asia. A seed is carried, perhaps by bird or by flood, to a riverside site where the seed germinates and start to grow. Cannabis is a ruderal (or pioneer) species - it moves into a disturbed area, grows very quickly and reproduces prolifically. To put it another way, the strategy of a ruderal plant is to 'get while the getting is good'. In order to take full advantage of the site and the season, a cannabis plant will grow as large as possible in the vegetative state before reproducing. To help with this, most cannabis a mechanism to sense the seasons - something called photoperiodism. By sensing the length of the day (or, actually, the night), cannabis plants 'know' that the days are shortening and that winter is coming. This triggers them to begin to flower and produce seeds, and the cycle continues....
Except when it doesn't. Imagine that our cannabis plant has been successful and produced a large quantity of seed. This seed is dispersed - birds pick up a number of seeds and carry them north, into the Russian steppe and beyond. These seeds find a favorable spot to germinate, grow to be large plants with the long days of summer, and then, just as they are starting to flower, a heavy frost comes and kills them all stone dead. No seeds. The plant has been betrayed by the photoperiod response, which convinced the plants that they should keep growing when when, in fact, there was no longer enough time for to reproduce.
This probably happened a lot. Millions of cannabis plants behaving like the grasshopper, when they should have been the ant. Eventually, that heavy selective pressure, combined with the process of mutation, resulted in a plant that no longer listened to its internal clock - and what is known as 'autoflowering' or day-neutral cannabis was born.
This variant cannabis will grow for the minimum amount of time possible in a vegetative state, and then transition to flowering, regardless of day-length. This adaptation allows it to complete the life-cycle in very short season areas, but comes at the cost of the ability to grow to large size. This trait, developed in the wild, has also proved to be a useful in the breeding of cultivated cannabis. By moving the trait from the weedy 'ruderalis' plants into a drug-producing background, breeders develop varieties that can produce outdoors regardless of day length. This has multiple benefits for the home gardener and commercial grower. The short cycle allows for outdoor harvest during favorable periods - avoiding the wet weather that caused 50% crop loss to mold in the Willamette Valley in 2016. The smaller plants are also easier to care for - they can be grown in a pot on a back porch, and do not require trellising and pruning which dramatically reduces labor inputs. The plants in the photo below are flowering in July.