It was just a suggestion, but one that investors in Staples SPLS and Office Depot ODP seemed to have loved: the two struggling office supplies giants should merge.

Shares in both companies soared on Tuesday after Credit Suisse in a research note recommended they combine forces to better compete against Amazon.com AMZN and Wal-Mart Stores WMT and stop declining sales at both.

Credit Suisse analyst Gary Balter estimated that by streamlining their operations, the companies together could save $1.44 billion a year, effectively doubling their combined operating profit by 2017. What’s more, a merged entity would be more strategic about store closings: both Staples and Office Depot are cutting stores by the dozen but often keeping a store that is unprofitable not to give up market share to its rival. That would mean that under a combination, only the best stores would remain.

A merger “makes significant financial and operational sense,” Balter wrote.

Regardless of whether they take Balter’s suggestions, it’s undeniable that both chains need to pick up their game.

Staples’ North American comparable sales haven’t risen since 2006 and in March, it announced it was closing 225 stores there. And while Staples has made some progress in building up its service business for corporate clients, and online its bread-and-butter sources of revenue are shrinking fast: sales of computer and technology accessories fell by a double-digit percentage last quarter and account of 20% of retail sales. Acknowledging the reality of how easily its wares can be sold online, Staples is gradually moving to a 12,000-square-foot format from a 24,000-square-foot format.

Office Depot, the weaker of the two, merged with OfficeMax not even a year ago to cut costs and take out a rival in a saturated North American market. It is also hurting: Office Depot’s North America retail same-store sales fell 3% last quarter, hurt in particular by a drop in sales of ink and toner, laptops and peripherals. (Both companies get a big chunk of revenues from services to businesses.)

And things won’t get any easier for these two retailers. Research firm IBISWorld expects sales to fall 0.8% a year through 2019, while more intense competition from Wal-Mart WMT , Amazon AMZN , and wholesale clubs like Costco Wholesale COST .

Balter estimated that buying Office Depot could boost Staples shares to as high as $30 by 2017, (they closed at $12.63 on Tuesday) but that it would have to pay an 80% premium on Office Depot shares. Balter dismissed anti-trust concerns, saying the Federal Trade Commission had signed off on the Office Depot/OfficeMax merger last year by saying the industry had fragmented sufficiently.

Either way, regardless of whether the companies have any interest or appetite for such a merger, the market forces may compel them too before long.

“Retail remains the anchor around both stocks’ neck,” Balter said. “Results in this segment remain abysmal for both companies, as the country is way overstored, particularly given an environment where 55% of core office supply products are estimated to be bought online today and retail traffic in general is down.”