Tom Stoppard’s 1974 play “Travesties,” which opened Tuesday at Roundabout’s American Airlines Theatre in a spirited, quick-paced revival, is a showcase for modern theater’s ultimate teacher’s pet.

Stoppard built his reputation for erudite riffs on classic material with early shows like “Rosencrantz and Guildenstern Are Dead,” which thrust two minor characters from “Hamlet” to center stage. In “Travesties,” he takes the structure and characters of Oscar Wilde’s “The Importance of Being Earnest” and adds often loopy layers of learned complication.

He centers his play on a real man named Henry Carr (Tom Hollander) who is a bit of a historical footnote: a British consular officer in 1917 Zurich who once sued James Joyce over a pair of trousers he had to buy for an amateur production of “Earnest.”

Yes, that James Joyce. The Irish author (here played by Peter McDonald) was holed up in Zurich at the time writing “Ulysses,” which was originally titled — as Stoppard does not fail to note — “Elasticated Bloomers.”

Stoppard also introduces two other historical figures who happened to be in Zurich during the waning days of World War I: the Dadaist poet Tristan Tzara (Seth Numrich) and a pre-Russian Revolution Vladimir Lenin (Dan Butler). Not to mention a librarian who becomes Carr’s wife (and doubles as Cecily from “Earnest”) and Joyce’s scrivener who morphs into Cecily’s Wildean counterpart, Gwendolen.

The literary gymnastics do not stop there. There is quick-witted wordplay (“My art belongs to Dada,” Tzara says at one point); an entire scene written in limerick form; a delightful music-hall-style duet of one-up-manship between Cecily and Gwendolen that is the highlight of the second act.

As Carr says at one point, “It may be nonsense, but at least it is clever nonsense.”

And under Patrick Marber’s masterful direction, “Travesties” never lets the mayhem swirl completely out of control. At the center of the madness is a bravura performance by Hollander, perhaps best known for screen roles as sidekicks who are either goofy (“Pirates of the Caribbean”) or vaguely sinister (“The Night Manager”).

Here, he portrays both an older, dementia-addled Carr, looking back on his Zurich experiences through hazy memories and malaprops, as well as the younger middle manager who rightly saw himself as the hero of his own story, the lead in that amateur Wilde production (“not Ernest, the other one”).

Marber’s staging really shines when it slows down the verbal pyrotechnics to explore the efficacy of art in challenging times, allowing Tzara to stump that “anti-art is the art of our time” and Lenin to make a case that art must only exist to serve the revolutionary cause — but ultimately backing Joyce’s more nuanced appeal for art for its own sake: “What now of the Trojan War if it had been passed over by the artist’s touch? Dust.”

17 Top-Grossing Broadway Musicals of All Time From 'Hamilton' to 'The Lion King' (Photos)