Skip to content

Conversation

@pelme
Copy link
Owner

@pelme pelme commented Jun 1, 2025

This is just ensure that tests can invoke the built rust code to make
sure that the test/build tooling works.

@pelme pelme force-pushed the pelme-pxstnyxw branch from fcd094d to 34c12d8 Compare June 1, 2025 10:46
This is just ensure that tests can invoke the built rust code to make
sure that the test/build tooling works.
@pelme pelme force-pushed the pelme-pxstnyxw branch from 34c12d8 to 2bfbb23 Compare June 1, 2025 12:55
@choucavalier
Copy link
Contributor

what is the goal of using rust in htpy? (just curious!)

@pelme
Copy link
Owner Author

pelme commented Oct 16, 2025

improved performance! played around with it but it seems to rather make performance worse since there are a lot of small/cheap calls happening. #157 is likely a better approach for improved performance. I have started working on a benchmarking suite to actually understand the performance of htpy (and templates and other HTML generation tools) better.

@choucavalier
Copy link
Contributor

i see! an interesting approach is compile time templates by Maud. probably out of scope but still interesting

@pelme
Copy link
Owner Author

pelme commented Oct 28, 2025

Maud looks like something I would use to generate HTML in Rust. 🙂

I think ast transforms is as close to compile time templates we can get here in Python. :)

My current plan is roughly:

  • Implement a decent suite of benchmarks to actually know what improves/degrades performance. Compare against jinja as a baseline for what decent performance looks like.
  • Implement ast transforms that transforms calls to article("#featured.bold")[p[h1["Hi"], text]] to something like CompiledElement('<article id="featured><p><h1>Hi</h1>' + escape(text) + '</article>'). Implement CompiledElement as Python.
  • Investigate if implementing CompiledElement in Rust would improve performance even more.

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.

3 participants