From 9eb949efe38a64b1e20be58eceeb03dddc6f5cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Haraldsson?= Date: Thu, 12 Sep 2024 12:33:00 +0000 Subject: [PATCH 1/4] Precompile Markdown parsing AND printing --- stdlib/Markdown/src/Markdown.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/Markdown/src/Markdown.jl b/stdlib/Markdown/src/Markdown.jl index 0d45d9e534df2..5a745e1209683 100644 --- a/stdlib/Markdown/src/Markdown.jl +++ b/stdlib/Markdown/src/Markdown.jl @@ -125,7 +125,7 @@ catdoc(md::MD...) = MD(md...) if Base.generating_output() # workload to reduce latency - md""" + println(devnull, md""" # H1 ## H2 ### H3 @@ -141,7 +141,7 @@ if Base.generating_output() `code` Horizontal Rule --- - """ + """) end end From e8426f469ea99732df73c24195af13cca93ce414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Haraldsson?= Date: Sat, 14 Sep 2024 23:17:27 +0000 Subject: [PATCH 2/4] Precompiles for non-devnull --- stdlib/Markdown/src/Markdown.jl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/stdlib/Markdown/src/Markdown.jl b/stdlib/Markdown/src/Markdown.jl index 5a745e1209683..ba253527324b9 100644 --- a/stdlib/Markdown/src/Markdown.jl +++ b/stdlib/Markdown/src/Markdown.jl @@ -124,6 +124,26 @@ import Base.Docs: catdoc catdoc(md::MD...) = MD(md...) if Base.generating_output() + precompile(Tuple{typeof(Base.println), Markdown.MD}) + precompile(Tuple{typeof(Base.println), Base.TTY, Markdown.MD}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{1}}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Array{Any, 1}}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, String}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{2}}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{3}}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Paragraph}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Bold, String, Vararg{Any}}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Bold}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, String, Array{Any, 1}, Vararg{Any}}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Italic}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.BlockQuote}) + + precompile(Tuple{typeof(Base.sprint), Function, Array{Any, 1}}) + precompile(Tuple{typeof(Base.print), Base.TTY, String}) + precompile(Tuple{typeof(Base.print), Base.TTY, Base.SubString{String}}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.List}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Code, String, Vararg{String}}) + # workload to reduce latency println(devnull, md""" # H1 From 99a2009fb68e0e4a579bdb91fedb8e75123b9138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Haraldsson?= Date: Sun, 15 Sep 2024 00:20:31 +0000 Subject: [PATCH 3/4] Precompiles for more complete Markdown tags --- stdlib/Markdown/src/Markdown.jl | 35 +++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/stdlib/Markdown/src/Markdown.jl b/stdlib/Markdown/src/Markdown.jl index ba253527324b9..f7492675470ab 100644 --- a/stdlib/Markdown/src/Markdown.jl +++ b/stdlib/Markdown/src/Markdown.jl @@ -126,31 +126,50 @@ catdoc(md::MD...) = MD(md...) if Base.generating_output() precompile(Tuple{typeof(Base.println), Markdown.MD}) precompile(Tuple{typeof(Base.println), Base.TTY, Markdown.MD}) + precompile(Tuple{typeof(Base.print), Markdown.MD}) + precompile(Tuple{typeof(Base.print), Base.TTY, Markdown.MD}) precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{1}}) - precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Array{Any, 1}}) - precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, String}) precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{2}}) precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{3}}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{4}}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{5}}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Header{6}}) precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.Paragraph}) + precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.BlockQuote}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Array{Any, 1}}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, String}) precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Bold, String, Vararg{Any}}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Italic, String}) + precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Bold, String}) precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Bold}) precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, String, Array{Any, 1}, Vararg{Any}}) precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Italic}) - precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.BlockQuote}) - + precompile(Tuple{typeof(Markdown.footnote_link), Base.GenericIOBuffer{GenericMemory{:not_atomic, UInt8, Core.AddrSpace{Core}(0x00)}}, Markdown.MD}) + precompile(Tuple{typeof(Base.sprint), Function, Array{Any, 1}}) + precompile(Tuple{typeof(Base.println), Markdown.MD}) + precompile(Tuple{typeof(Base.println), Base.TTY, Markdown.MD}) precompile(Tuple{typeof(Base.print), Base.TTY, String}) precompile(Tuple{typeof(Base.print), Base.TTY, Base.SubString{String}}) precompile(Tuple{typeof(Markdown.plain), Base.TTY, Markdown.List}) precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Code, String, Vararg{String}}) + precompile(Tuple{typeof(Markdown.linebreak), Base.GenericIOBuffer{GenericMemory{:not_atomic, UInt8, Core.AddrSpace{Core}(0x00)}}, Markdown.MD}) + precompile(Tuple{typeof(Markdown.escapes), Base.GenericIOBuffer{GenericMemory{:not_atomic, UInt8, Core.AddrSpace{Core}(0x00)}}, Markdown.MD}) + + precompile(Tuple{typeof(Base.:(^)), String, Int64}) # Belongs elsewhere? + # workload to reduce latency println(devnull, md""" # H1 ## H2 ### H3 + #### H4 + ##### H5 + ###### H6 **bold text** *italicized text* + ***bold and italicized text*** > blockquote 1. First item 2. Second item @@ -158,9 +177,17 @@ if Base.generating_output() - First item - Second item - Third item + - Indented item `code` Horizontal Rule --- + **[Duck Duck Go](https://duckduckgo.com)** + + + ![The San Juan Mountains are beautiful!](/assets/images/san-juan-mountains.jpg "San Juan Mountains") + + H~2~O + X^2^ """) end From 470f78ee844fc37ebf6c70a7ea482d3b14b24750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Haraldsson?= Date: Sun, 15 Sep 2024 00:23:28 +0000 Subject: [PATCH 4/4] Update Markdown.jl - fix whitespace --- stdlib/Markdown/src/Markdown.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/Markdown/src/Markdown.jl b/stdlib/Markdown/src/Markdown.jl index f7492675470ab..91ba137e4d222 100644 --- a/stdlib/Markdown/src/Markdown.jl +++ b/stdlib/Markdown/src/Markdown.jl @@ -145,7 +145,7 @@ if Base.generating_output() precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, String, Array{Any, 1}, Vararg{Any}}) precompile(Tuple{typeof(Markdown.plaininline), Base.TTY, Markdown.Italic}) precompile(Tuple{typeof(Markdown.footnote_link), Base.GenericIOBuffer{GenericMemory{:not_atomic, UInt8, Core.AddrSpace{Core}(0x00)}}, Markdown.MD}) - + precompile(Tuple{typeof(Base.sprint), Function, Array{Any, 1}}) precompile(Tuple{typeof(Base.println), Markdown.MD}) precompile(Tuple{typeof(Base.println), Base.TTY, Markdown.MD}) @@ -156,9 +156,9 @@ if Base.generating_output() precompile(Tuple{typeof(Markdown.linebreak), Base.GenericIOBuffer{GenericMemory{:not_atomic, UInt8, Core.AddrSpace{Core}(0x00)}}, Markdown.MD}) precompile(Tuple{typeof(Markdown.escapes), Base.GenericIOBuffer{GenericMemory{:not_atomic, UInt8, Core.AddrSpace{Core}(0x00)}}, Markdown.MD}) - + precompile(Tuple{typeof(Base.:(^)), String, Int64}) # Belongs elsewhere? - + # workload to reduce latency println(devnull, md""" # H1