[GH-ISSUE #73] slow dumper.DumpLuaBlock #31

Closed
opened 2026-02-28 01:20:36 +03:00 by kerem · 2 comments
Owner

Originally created by @gtors on GitHub (Dec 12, 2025).
Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/73

dumper.DumpLuaBlock takes ~200 ms for just 2 lines of Lua — the bottleneck is the formatter.

Could formatting be optional? For example:

  • WithLuaFormatting(false) (default true), or
  • WithLuaFormatter(customFormatter) to allow plugging in a faster/no-op implementation.
Image
Originally created by @gtors on GitHub (Dec 12, 2025). Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/73 `dumper.DumpLuaBlock` takes ~200 ms for just 2 lines of Lua — the bottleneck is the formatter. Could formatting be optional? For example: - `WithLuaFormatting(false)` (default `true`), or - `WithLuaFormatter(customFormatter)` to allow plugging in a faster/no-op implementation. <img width="1856" height="362" alt="Image" src="https://github.com/user-attachments/assets/4ad0ba11-341d-4e59-bcca-3a579454b6e0" />
kerem closed this issue 2026-02-28 01:20:36 +03:00
Author
Owner

@gtors commented on GitHub (Dec 12, 2025):

Fix it locally by replacing package in go.mod

replace github.com/imega/luaformatter => ./luaformatter_stub

Content of ./luaformatter_stub/formatter/formatter.go:

package formatter

import (
	"io"
)

type Config struct {
	IndentSize    any
	MaxLineLength any
	Highlight     any
	Spaces        any
	Alignment     any
}

func DefaultConfig() Config {
	return Config{}
}

func Format(c Config, b []byte, w io.Writer) error {
	_, err := w.Write(b)
	return err
}
<!-- gh-comment-id:3646237457 --> @gtors commented on GitHub (Dec 12, 2025): Fix it locally by replacing package in `go.mod` ``` replace github.com/imega/luaformatter => ./luaformatter_stub ``` Content of `./luaformatter_stub/formatter/formatter.go`: ```go package formatter import ( "io" ) type Config struct { IndentSize any MaxLineLength any Highlight any Spaces any Alignment any } func DefaultConfig() Config { return Config{} } func Format(c Config, b []byte, w io.Writer) error { _, err := w.Write(b) return err } ```
Author
Owner

@tufanbarisyildirim commented on GitHub (Feb 20, 2026):

Implemented in #77: Lua formatting is now optional (WithLuaFormatting(false)) and pluggable via WithLuaFormatter(...).

<!-- gh-comment-id:3932203759 --> @tufanbarisyildirim commented on GitHub (Feb 20, 2026): Implemented in #77: Lua formatting is now optional (`WithLuaFormatting(false)`) and pluggable via `WithLuaFormatter(...)`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gonginx#31
No description provided.