When Marissa Mayer became the CEO of Yahoo in 2012, famed Silicon Valley venture capitalist Marc Andreessen told her the best way to fix the company would be to fire thousands of employees right away and all at once.

Mayer never took his advice.

On Friday, Business Insider published an excerpt from a book called "Marissa Mayer and the Fight to Save Yahoo!"

It reveals that Andreessen wasn't the only one favoring mass layoffs at Yahoo. The board members who hired her also wanted drastic cuts. Mayer's CEO predecessor, Scott Thompson, had been working on them. Senior executives at the company were working on deals with Microsoft and Google that would have also resulted in major cuts.

Here's the story, from the excerpt of "Marissa Mayer and the Fight to Save Yahoo!":

Mayer [made the choice not to fire 5,000 Yahoo employees] three times.

When she joined Yahoo in the summer of 2012, one of the first meetings she took was with a company executive named Jim Heckman. Heckman had been a top dealmaker for the interim management team that had immediately preceded Mayer. In that meeting, Heckman told Mayer that he had deals lined up with Google, Microsoft, and a New York advertising technology company called AppNexus. The plan was to outsource various Yahoo functions to each. Then Yahoo would be able to get rid of as much as a third of its headcount.

Within a day of the meeting, Mayer canceled all the deals and asked Heckman to leave the company.

Then Mayer had to decide what to do about Project Alpha.

Project Alpha was the code name for a massive overhaul of Yahoo begun by another one of Mayer’s predecessors, Scott Thompson. Thompson had been Yahoo CEO for only a short time—from January 2012 to May 2012—but Project Alpha was going to leave a mark. It called for Yahoo to reduce its number of data centers from thirty-one to six and its workforce of fifteen thousand employees and three thousand contractors by as much as a third. Thompson initiated Project Alpha on April 4, 2012. When he did that, hundreds of Yahoo employees were told that eventually they were going to be fired, but not just yet. This was called getting put “on transition.”

Project Alpha sought to reduce Yahoo’s workforce by cutting whole divisions from the company rather than by examining the work of each employee in each group and identifying the poor performers who should go and the high performers who should stay, even if that meant moving to another group. When Mayer heard that, she couldn’t believe it. She quickly reduced the scope of Project Alpha and asked her top executives to recruit back into the company high-performing Yahoo employees that Thompson had put on transition. At an FYI on September 28, 2012, Mayer told employees that Thompson’s plans had damaged Yahoo’s culture and that she wouldn’t be using the same kind of cost-cutting tactics.

Finally, Mayer had to deal with the board, which also wanted her to fire lots of Yahoos.

When Yahoo’s board of directors hired Mayer in July 2012, the directors made clear to her that they thought she should cut headcount by as much as 35 to 50 percent.

Mayer seemed to get the idea but made no promises in her interviews for the job. She did, however, agree that Yahoo needed to reduce its costs and focus on making fewer products better. She said that by her first board meeting, in September 2012, she would present a cost-cutting strategy.

The notion that Yahoo needed to fire a lot of its people was conventional wisdom within the industry by the time Mayer took over in summer 2012. The week of her hire, Marc Andreessen, a widely respected startup investor who had been part of a private equity group that looked at buying Yahoo in 2011, told a reporter that Yahoo should fire ten to twelve thousand people.

So when that board meeting came in September, several directors, including hedge fund manager Dan Loeb, the director most responsible for Mayer’s hire, expected her to present a plan for layoffs.

That’s not what Loeb and the rest of the board got. Mayer told them that layoffs of any kind, let alone 35 to 50 percent cuts, would be too damaging for employee morale. She said that Yahoo’s basic infrastructure was so byzantine and jerry-built that it would be unwise to blindly rip whole teams of people out. She said Yahoo was going to need all the talent it could find to turn around, and she didn’t want to risk putting good people on the street.

Many of the directors, including Loeb, didn’t like what they heard, and there was some tension in the room. But they’d just made a huge bet on Mayer only months before, and there was no choice but to go with her plans.

Mayer was thrilled.

On October 12, 2012, Mayer got the chance to share the good news, when, at an [all-hands meeting], an employee asked if reports about layoffs were true.

Mayer, standing onstage in front of a giant purple curtain backdrop, said, “So are there secret talks going on about massive layoffs and massive reorganizations?

"No.

“Have I had conversations with people about them?“

“No.

“Is this something that weighs on me?

“Yes.

“You probably have heard and seen some of the comments from Marc Andreessen and others about how many people might need to be laid off. Have I heard some of those?

“Yes.

“Do they weigh on me?

“Yes.

“Have I been actively considering plans around them?

“No.

She said that Yahoo would still have to make some changes, but that she wanted them to be “small.”

“As of right now, we’re not looking at layoffs. We’re looking at stabilizing the organization. I can’t make a promise that there won’t be a change in that in the future, but as of right now, there’s no active planning or conversations going on.”

Then Mayer said something about how Yahoo would get “fit as a company” by setting goals and then using those goals to measure “who’s performing well” and “who’s struggling.” Few in the room thought much about what she meant by that. What they heard Mayer saying was: I’m not going to fire you, your friends, or ten thousand other people.

The Yahoos started clapping.

Mayer liked the applause.

“You should feel good about that,” she said. “That should be a giant round of applause, a big sigh of relief from everybody.”

Eventually, instead of layoffs, Mayer chose to control costs and improve Yahoo's talent base through a employee-reviews system called "QPRs." Employees on every team were ranked on a curve from 1 to 5. Over time, lower performers were pushed out of the company. It was pretty controversial inside the company.

These days, some investors wish Mayer had been more aggressive with layoffs. One of them is Jeff Smith, the activist investor in charge of Starboard Ventures — a fund that owns a rumored 2% of Yahoo. In October, he wrote Mayer a letter suggesting that deeper layoffs could save the company $1 billion in costs.

Click here to see "Marissa Mayer and the Fight to Save Yahoo!" on Amazon >