Skip to content

Avoid collecting chars into Vec<char> in tokenize_markdown function #68

@coderabbitai

Description

@coderabbitai

Description

The tokenize_markdown function in src/lib.rs currently materialises the whole input as a Vec<char>, which duplicates the memory footprint of the string.

Location

  • File: src/lib.rs
  • Lines: 231-233 (approximately)
  • Function: tokenize_markdown

Issue

The current implementation collects all characters into a Vec<char> which:

  • Doubles the memory usage of the input string
  • Creates unnecessary memory allocations
  • Could impact performance for large inputs

Context

This performance issue was flagged in a previous review and was previously tracked in issue #63.

Backlinks

Requested by: @leynos

Metadata

Metadata

Assignees

Labels

mediumCould be disruptive, but might not happen

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions