Greg Smith is obsessed with the freshness of strawberries.

Walmart's top U.S. supply-chain executive is overhauling the retail giant's distribution system, and in his mind speed is paramount.

Strawberries have only 12.2 days of life after picking, he reckons, and the firm did not always get them to stores fast enough. The radical changes he is introducing can sometimes cut three to four days out of their journey to the store.

In the past, Walmart had a one-size-fits-all approach to its supply chain, he said, but now it is fast-tracking certain perishable and quick-selling goods. It used to keep inventories stored at warehouses, but now it is "flowing" priority goods directly to retailers. When trucks get to stores, fresh items are sent directly to shelves.

To gauge progress, visit a Walmart outlet near the company's headquarters in Bentonville, Ark. A robot made by Bossa Nova, a Californian startup, roams the isles scanning every shelf for out-of-stock items. The back of the store houses a semi-automated system for unloading trucks. The stockroom is surprisingly bare. An inspection of the produce aisles confirms that the strawberries are, indeed, delectably fresh.

The story of the speedy strawberry illustrates a broader transformation. "Retail before Walmart was slow, lumbering and inefficient," said an industry veteran.

The firm revolutionized supply chains once, before the arrival of the internet, by stripping out inefficiencies in logistics and telling the world's biggest brands that it would manage their product flow through its superior supply chain. Now it wants to repeat the trick for a more digitized age. Smith said Walmart is replacing all its supply-chain systems, physical and digital, to shift from batch processing to continuous replenishment.

Upstream, the firm is investing in technologies that he hopes will allow it to track individual stock-keeping units (SKUs) through the supply chain. Its warehouses are introducing automatic storage and retrieval systems and autonomous vehicles (AVs). This month, the firm will open an automated facility in California that will handle three times the volume of ordinary ones.

Walmart is moving faster downstream, too. It is working with Alert Innovation, an automation startup, to develop a robot that can fill online grocery orders more quickly. It is crowdsourcing the last-mile delivery of orders through a service called Spark Delivery. All this is producing results. Productivity at distribution centers, measured in cases per hour, went up 13% in 18 months. Billions of dollars have been stripped out of inventory. In the most recent quarter, same-store U.S. sales were up 3.4% on the previous year and e-commerce sales up 37%.

On May 1, Walmart implemented a new policy under which suppliers must meet tougher "On Time, In Full" targets for deliveries of stock or else suffer hefty fines. On June 7, it unveiled a new service that allows customers who order groceries online to have them delivered directly into their fridge.

Said one Walmart executive: "A competitor who will remain nameless … is forcing all of us to think differently, and we should."

Amazon's introduction of the idea of "low cost, always in stock" is turbocharging innovation. The new front-line is next-day delivery. More than half of Amazon's U.S. customers — some 100 million people — are Prime members who pay an annual fee to get free two-day shipping. They spend about $1,400 a year each with the firm, more than double the amount spent by non-Prime shoppers.

The firm operates dozens of fulfillment centers and has splashed out on automation. With the aid of machine-learning algorithms, robots work in tandem with humans to pick and pack items speedily. By one estimate, Amazon can usually ship a parcel hours after an online purchase despite operating with a third less inventory than typical retailers.

By employing predictive models, the firm works out where orders are likely to come from. It then uses its knowledge of consumers to manage capacity, place products closer to them and determine delivery routes. Its integrated model gives it a massive data advantage over rivals that allows it "to have visibility through the entire supply chain," said Udit Madan, its last-mile-delivery guru.

The competition heats up

Now the race is heating up. In April, Amazon announced plans to spend $800 million upgrading its supply-chain infrastructure in the second quarter to speed up free delivery worldwide, from two days to one. In May, Walmart fired back. It unveiled free one-day delivery on more than 200,000 items in its online store for orders over $35. It expects the service, which requires no membership, to be available in most of the United States by the end of this year. It will spend over $200 million on infrastructure.

Complexity and variability in the messy megalopolises of emerging markets (because of the lack of formal addresses, say, and standstill traffic) spur innovation. In such markets, his drivers carry handheld devices that allow the cancellation of orders up to a minute before delivery.

The rich-world giants are right to look to the developing world for inspiration. China is leapfrogging from ropy logistics to supercharged supply chains, just as it did with e-commerce and mobile payments, in which it went from laggard to world-beater.

The robots come out after dark in Hangzhou. Seven hundred of them are moving around in a large distribution center run by China Post, the state-run postal carrier. These flat yellow workhorses made by Libiao, a local startup, work through the night sorting packages for delivery across China. Workers scan packages and place them on the devices. The robots make their way to the chute for the destination city among scores of openings and drop the packages in. On the floor below the packages are whisked from the chutes to waiting lorries.

China blends cutting edge, affordability

Amazon leads in the use of robots in logistics, but China's entrepreneurs have the edge in speed. Mainland innovators are capable of cutting-edge inventions, for example in facial-recognition software. However, they are also good at frugal engineering, throwing together cheap solutions that can get to market faster than the gold-plated ones favored by Western innovators.

Xia Huiling, who co-founded Libiao with her husband, eschewed complex artificial intelligence and navigation systems that would have made each robot autonomous, in order to keep the system affordable. Her dumb robots merely follow trajectories calculated centrally. Through Tompkins, a U.S. supply-chain firm, Libiao is trying an inventive business model too. Retailers facing seasonal demand spikes can lease a handful of robots for as long as needed. "They are plug and play," Xia said.

Libiao is one of the promising startups in which GLP, a privately held Singapore logistics investment firm, has a stake. Victor Mok, GLP's China co-president, is introducing logistics parks with smart gates and loading docks for expedited clearing of lorries as well as automation inside warehouses. Through its investment in startup Inceptio, it is developing autonomous trucks, too.

Not far from the China Post warehouse is the headquarters of Alibaba, the world's biggest e-commerce firm by transaction volume. On its campus is an outlet of Hema Xiansheng, a chain in which it has a stake. It looks like a conventional supermarket, albeit with an unusually large selection of Maine lobsters. On closer inspection, many shoppers appear to be leaving without proffering payment. Bags of groceries whiz by on an overhead conveyor system.

Hema has invested in the technologies needed to combine online and offline shopping. In-store shoppers can pay using facial-recognition. The flying groceries go to waiting couriers, who deliver online orders free within a 2-mile radius within 30 minutes.

Cainiao, Alibaba's logistics platform, is investing $14.5 billion upgrading logistics to ensure next-day delivery in China and three-day delivery worldwide. "Our warehouse system is the most heavily used in the world," said Ben Wang of Cainiao.

Last year, on Nov. 11, a shopping extravaganza known as Singles Day, the firm sold $30 billion-worth of goods. Shoppers wearing virtual-reality goggles could buy stuff with a flick of the head. Cainiao delivered the first 100 million parcels (of 1 billion orders) within 2.6 days, better than 2.8 days a year earlier.

Amazon is looking at drones and autonomous robots for the last mile, which it considers the choke point for fast delivery.

Ask Amazon's Madan to look five years ahead and he predicts that product selection will grow and delivery will get even faster. "Thirty minutes," he said. "Maybe 15."

How can the rest of the industry keep pace with supercharged superstars like Amazon and Alibaba? The only hope is for them to make their supply chains smarter.