gitea源码

markdown_benchmark_test.go 569B

1234567891011121314151617181920212223242526
  1. // Copyright 2024 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package markdown_test
  4. import (
  5. "testing"
  6. "code.gitea.io/gitea/modules/markup"
  7. "code.gitea.io/gitea/modules/markup/markdown"
  8. )
  9. func BenchmarkSpecializedMarkdown(b *testing.B) {
  10. // 240856 4719 ns/op
  11. for b.Loop() {
  12. markdown.SpecializedMarkdown(&markup.RenderContext{})
  13. }
  14. }
  15. func BenchmarkMarkdownRender(b *testing.B) {
  16. // 23202 50840 ns/op
  17. for b.Loop() {
  18. _, _ = markdown.RenderString(markup.NewTestRenderContext(), "https://example.com\n- a\n- b\n")
  19. }
  20. }