home

Markdown Style Test

This is a test post to preview how different markdown features render.

Headings

Third level

Fourth level

Text formatting

This is a paragraph with bold text, italic text, and inline code. Here’s a link to GitHub and some strikethrough text.

This is a blockquote. It can span multiple lines and is useful for highlighting important information or quoting someone.

Code blocks

@attached(peer, names: arbitrary)
public macro Modifier() = #externalMacro(
    module: "ModifierMacroMacros",
    type: "ModifierMacro"
)

public struct ModifierMacro: PeerMacro {
    public static func expansion(
        of node: AttributeSyntax,
        providingPeersOf declaration: some DeclSyntaxProtocol,
        in context: some MacroExpansionContext
    ) throws -> [DeclSyntax] {
        guard let varDecl = declaration.as(VariableDeclSyntax.self) else {
            return []
        }
        return [DeclSyntax(stringLiteral: "// generated")]
    }
}
def generate_large_macro(num_modifiers: int):
    content = "import ModifierMacro\n\nstruct Button {\n"
    for i in range(num_modifiers):
        content += f"    @Modifier private var modifier{i}: Double = 0.0\n"
    content += "}\n"
    return content

Lists

Unordered:

  • First item
  • Second item with a longer description that wraps to the next line
  • Third item
    • Nested item
    • Another nested item

Ordered:

  1. Clone the repo
  2. Run swift build -c release
  3. Execute the benchmark
  4. Check results.json

Table

ScenarioFilesModifiersTime
Default110.42s
Macro110.89s
Large Default120003.21s
Large Macro120004.67s
Multi-file10020 each5.12s
Multi-file Macro10020 each7.34s

Mermaid diagram

graph LR
    A[Source Code] --> B[SourceKit]
    B --> C[Module Interface]
    C --> D[SwiftSyntax Rewriter]
    D --> E[Interface Module]

Horizontal rule


Image

Placeholder
Placeholder

Task list

  • Set up blog
  • Customize theme
  • Write first real post
  • Cross-post to Medium

Footnote

Swift macros expand at compile time1, which means their cost is paid on every build.

Footnotes

  1. See the Swift Evolution proposal SE-0389 for details on the macro system.