Watch a clip from the Martin Scorsese film "The Wolf of Wall Street" featuring a scene with Jonah Hill and Leonardo DiCaprio as Jordan Belfort. (Photo/Video: Paramount Pictures)

In an early scene in "The Wolf of Wall Street," a fresh-faced stockbroker at L.F. Rothschild (Leonardo DiCaprio) is having lunch at a five-star restaurant with his new boss (Matthew McConaughey), who proceeds to openly snort cocaine, drink several martinis and hum a primal tune while beating his chest and uttering sporadic macaw-like sounds.

The singing, like many of the more outrageous moments in the film, was entirely improvised.

Director Martin Scorsese "saw that he had this unbelievably fertile group of actors, and he thought, 'Well, we haven't done improvisation in a while, but we're known for it,'" says Thelma Schoonmaker, who has edited all of his feature films since 1980s "Raging Bull," for which she won the first of three Oscars.

Many of Mr. Scorsese's most iconic scenes were unscripted. One famous example: the tense confrontation in "Goodfellas" (1990) between Ray Liotta and Joe Pesci when Mr. Pesci's character, mobster Tommy DeVito, says "I'm funny how? How am I funny?" But "The Wolf of Wall Street," due in theaters Dec. 25, contains more improvisation than most of the director's recent films.

Directed by Scorsese, Edited by Schoonmaker

Thelma Schoonmaker has edited all of director Martin Scorsese's feature films since 1980's "Raging Bull." Everett Collection

As a result, the film's running time had ballooned to four hours and 10 minutes when it was screened for its producers over the summer. The first cut of Mr. McConaughey's madcap lunch scene was six minutes, 11 seconds long. "It was painful to think of a single frame coming out," says producer Emma Tillinger Koskoff. (The scene now runs more than five minutes.)

The delicate task of shaving down the film to a just-barely-acceptable two-hour-and-59-minute runtime—without cutting a single raucous scene, disrupting the flow of the movie or straying too far from the plot—fell to Ms. Schoonmaker. "You keep honing down to the skeleton, and it's hard," she says. "Giving up things is hard. But I have always had to do it." While the actors have been shown some of the footage that wound up on the cutting-room floor, it is unlikely that audiences will ever see it; Mr. Scorsese doesn't believe in director's cuts.

Starting in the fall, she and Mr. Scorsese began working seven days a week to finish the film in time for a revised Dec. 25 release date, so the picture would still be eligible for awards-season consideration. (The movie had missed its original Nov. 15 date, resulting in some last-minute schedule-scrambling from Paramount Pictures.)

"People loved the long cut," says Ms. Schoonmaker. "But you just can't distribute a film of that length—it's not feasible." Despite the fact that the studio was targeting a 2.5-hour runtime, she says, Paramount executives agreed that the film was finished when it Mr. Scorsese screened the nearly three-hour version.

"Everybody was anxious to have the movie ready this year," says Ms. Tillinger Koskoff. "Ultimately [Paramount] deferred to Marty when he presented his final cut." Paramount said executives weren't available to comment.

Ms. Schoonmaker, 73, met Mr. Scorsese 50 years ago while she was taking a summer-editing course at NYU. She helped him edit his first feature film, 1967's "Who's That Knocking at My Door." They stayed in touch, working together on "Woodstock," a 1970 documentary, but didn't start collaborating regularly until "Raging Bull." Soon thereafter, Mr. Scorsese introduced Ms. Schoonmaker to one of his filmmaking heroes, the late director Michael Powell ("The Red Shoes," with longtime co-director Emeric Pressburger), who became her husband. He died in 1990.

Sitting in her New York office, the walls adorned with movie posters and a list cataloging all the 248 scenes in "Wolf," Ms. Schoonmaker recalled how she and Mr. Scorsese often found themselves "roaring with laughter" while combing through the unedited footage. At one point, she says her assistants came into the editing room to ask if everything was all right, because she was cackling so much while watching a 20-minute take showing the Stratton Oakmont executive team being deposed by the Securities and Exchange Commission. The scene was eventually shaved to five minutes, a process she described as excruciating.

Whether or not audiences would find the scenes as funny as she and Mr. Scorsese did was an open question. "When you are sitting in the editing room, you don't feel [the reaction] from the audience," says Ms. Schoonmaker. "Especially with a comedy—and I guess this is a black comedy—the first time we screened it and heard the laughter, it was great."

Normally, the duo will screen their films about 12 times before locking picture. But owing to the time crunch, they were only able to host six "Wolf" screenings, attended by friends and friends-of-friends, to get their feedback. Ms. Schoonmaker had suspected that one scene, in which Mr. DiCaprio's character is teaching his ragtag band of brokers how to sell to rich people, went on for too long. The test audiences noted that in their comment cards, too, confirming her hunch. So, she kept slicing away bits of dialogue, "until people didn't tell us that anymore."