From 517f65a7cc3e94b9c4ad574369a32c48e0a95be6 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 23 Jan 2018 21:29:58 +0100 Subject: Lua filters: store constructors in registry Lua functions used to construct AST element values are stored in the Lua registry for quicker access. Getting a value from the registry is much faster than getting a global value (partly to idiosyncrasies of hslua); this change results in a considerable performance boost. --- src/Text/Pandoc/Lua/Module/Pandoc.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Lua/Module') diff --git a/src/Text/Pandoc/Lua/Module/Pandoc.hs b/src/Text/Pandoc/Lua/Module/Pandoc.hs index f458d4773..b9410a353 100644 --- a/src/Text/Pandoc/Lua/Module/Pandoc.hs +++ b/src/Text/Pandoc/Lua/Module/Pandoc.hs @@ -82,7 +82,7 @@ readDoc content formatSpecOrNil = do res <- liftIO $ runIO $ r def{ readerExtensions = es } (pack content) case res of Right pd -> (1 :: NumResults) <$ Lua.push pd -- success, push Pandoc - Left s -> Lua.raiseError (show s) -- error while reading + Left s -> Lua.raiseError (show s) -- error while reading _ -> Lua.raiseError "Only string formats are supported at the moment." -- | Pipes input through a command. -- cgit v1.2.3