The title novella of A.S. Byatt’s 1997 collection, The Djinn in the Nightingale’s Eye, tells the story of 50-something scholar Gillian Perholt, who, during a trip to Turkey for a conference, stumbles upon a glass bottle at an out-of-the way shop. It turns out to contain a djinn, or genie, who offers to grant the academic three wishes. As she mulls her choices, he tells her the enchanting story of his long life. A new movie version of this offbeat tale, Three Thousand Years of Longing, starring Idris Elba and Tilda Swinton, hits theaters on Aug. 26.

It’s intriguing that Byatt’s story is so formless, languorous, and digressive, considering that its main character is an expert on the subject of narratology, the study of narrative structure. Byatt has her protagonist muse on a two-word phrase used by John Milton (“floating redundant”); lingers on Gillian’s presentations at a conference in Ankhara, Turkey, including her extensive interpretation of “The Clerk’s Tale” by Geoffrey Chaucer; offers Gillian’s colleague’s presentation on One Thousand and One Nights; describes Gillian’s wanderings through the city streets, and on and on.

It’s a frequently fascinating work that’s insightful and deeply thoughtful about storytelling and folklore. Not much actually happens in it, though, for quite a while. Along the way, Gillian has a brief encounter with an old, hairless man at a museum; later, her colleague playfully wonders if the person was, in fact, a magical djinn. It’s only later on—and quite a way into the novella—that Gillian finds that bottle and releases an actual djinn.

The film thankfully gets to this part of the story more quickly, excising most of Byatt’s lengthy literary analyses; viewers hoping to hear Swinton riff on The Canterbury Tales will be sadly disappointed. Instead, her character (renamed Alithea) has a few mystical visions—which she, more or less, dismisses—until she finds herself face to face with the real-life djinn, played by Elba. Initially, the djinn is an imposing, room-sized being (and a triumph of CGI), but he soon he shrinks down to human size. Most of the film, from this point on, consists of the two characters chatting about history, life, and love while lounging around in bathrobes, with frequent flashbacks as the djinn tells the story of his long life. These sections are wonderfully reminiscent of ancient folk tales, as the djinn reveals encounters with the Queen of Sheba and Solomon; powerful leaders and enslaved people; and a brilliant woman with whom he was once very much in love.

In Byatt’s story, these tales are told relatively quickly—almost in summary, with little visual detail to bring them to vibrant life. Director George Miller (Mad Max: Fury Road) wisely makes them the focus of his film, with lush costume and set designs that are breathtaking in their beauty. Both the novella and film, though, feature troubling treatments of women above a certain weight. One story, for instance, lingers on a harem made up of “the fleshiest, the hugest women,” one of whom the djinn describes as “the fattest of all…the most like a sweet-breathed cow”—a “globular lady” who’s “self-satisfied and slow-witted.” In the film, Miller does Byatt one better—or, rather, worse—by giving the woman the infantilizing name “Sugar Lump.”

Indeed, women’s physical forms are a recurring focus of Byatt’s original story, in which Gillian even uses one of her precious wishes to make her body appear 20 years younger. Both the novella and movie center the protagonist’s main wish, though, which is to make the djinn love her—a thorny proposition that the film explores in a somewhat more compelling and emotional way.

Elba’s performance as the djinn is brilliantly understated, conjuring up a being of exquisite power and simmering passion, and Swinton’s portrayal of Alithea is similarly nuanced, effectively drawing the audience into the thoughts and feelings of a solitary person as she unexpectedly experiences the joys of personal connection. It’s unfortunate that, for all these actors’ talents, they can’t quite generate convincing romantic chemistry—an undeniable problem in a film that, first and foremost, is about the powerful sorcery of love. Still, the movie, as the tile indicates, is fiery with emotion compared to Byatt’s work, which seems mainly interested in the story part of its love story. Overall, it’s hard not to wish for more—from both the original tale and its adaptation.

David Rapp is the senior Indie editor.