jamboree / bustache

C++20 implementation of {{ mustache }}
82 stars 10 forks source link

New kid on the block #31

Closed mincequi closed 1 year ago

mincequi commented 1 year ago

Hey there, i just wanted to let you know, that there is a new kid on the block. Since i had the need for a small, fast and memory efficient template engine for a micro controller (e.g. ESP8266), i wrote one: https://github.com/mincequi/tinja

Also did some performance checks with bustache. But please, check yourself.

Hopefully, you find this interesting.

jamboree commented 1 year ago

Looks interesting 😎. I observed 3x~4x difference between bustache & tinja on my machine.

mincequi commented 1 year ago

Nice to hear. Hopefully, difference means tinja is also faster on your machine? Maybe, i will find the time to implement the full mustache spec, but as of now, this is sufficient for my purposes. I also wanted to keep my impl small (200 lines of code).

jamboree commented 1 year ago

Nice to hear. Hopefully, difference means tinja is also faster on your machine?

Yep.

BTW, in case you didn't know, you could feed your tinja::DataMap to bustache::format, you only need to implement some traits for tinja::StringRef, also, I'm curious why it's not std::string_view but std::reference_wrapper<const String>. I guess you want to avoid the ambiguity in Data variant constructor?

mincequi commented 1 year ago

Yep, i am aware that i could use tinja::DataMap to bustache. I also tried to use your native data implementation. However, i did not succeed yet and i simply took the nlohmann adapter, because i was using that anyway for another template engine.

I did some performance comparions with std::string_view and std::reference_wrapper<const String> and discovered, that the latter is even more performant than std::string_view. Avoiding the ambiguity had been a nice side-effect. :)