Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve Rust code. #114

Merged
merged 3 commits into from
Feb 12, 2025
Merged

chore: Improve Rust code. #114

merged 3 commits into from
Feb 12, 2025

Conversation

huacnlee
Copy link
Owner

@huacnlee huacnlee commented Feb 12, 2025

  • Use string to push char to reduce memory alloc.
  • Use LazyLock to make static font loader for reduce alloc Font.
  • Inline some short functions.

Benchmarks

Before

Warming up --------------------------------------
      Generate image    83.000 i/100ms
Calculating -------------------------------------
      Generate image    834.449 (± 1.8%) i/s    (1.20 ms/i) -      4.233k in   5.074422s

After

Warming up --------------------------------------
      Generate image    84.000 i/100ms
Calculating -------------------------------------
      Generate image    859.075 (± 1.5%) i/s    (1.16 ms/i) -      4.368k in   5.085775s

@huacnlee huacnlee merged commit 6eb4125 into main Feb 12, 2025
1 check failed
@huacnlee huacnlee deleted the format-code branch February 12, 2025 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant