youtube / spitfire

A high-performance Python template language
BSD 3-Clause "New" or "Revised" License
406 stars 58 forks source link

Python3 #82

Open mattip opened 4 years ago

mattip commented 4 years ago

Builds on #81 so that PYTHON=python2 make tests and PYTHON=python3 make tests both pass

googlebot commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

googlebot commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

mattip commented 4 years ago

we still run this in a benchmark for PyPy at speed.pypy.org

mattip commented 4 years ago

@googlebot I signed it!

googlebot commented 4 years ago

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

googlebot commented 4 years ago

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

jbjuin commented 4 years ago

Hi, is this solved yet ? Python3 would be a huge improvement. Can't wait to compare this with other engines.

re-masashi commented 1 month ago

I might be too late but i have a fork supporting Python 3.

# Python 3.10.9 (main, Dec 19 2022, 17:35:49) [GCC 12.2.0] on linux
$ python tests/benchmarks/render_benchmark.py
Running benchmarks 1000 times each...

Genshi tag builder                            646.05 ms
Genshi template                               226.59 ms
Genshi template + tag builder                 448.92 ms
Mako Template                                  58.38 ms
Spitfire template                              33.79 ms
Spitfire template -O1                          20.66 ms
Spitfire template -O2                          12.94 ms
Spitfire template -O3                           8.19 ms
StringIO                                        7.95 ms
cStringIO                                       9.73 ms
list concat                                     7.32 ms
Jinja2 templates                               15.84 ms

this is how the new benchmarks look (with the C acceleration turned off ).

mattip commented 1 month ago

Is that fork significantly different than this PR?

re-masashi commented 1 month ago

Is that fork significantly different than this PR?

spitfire was designed way back. today, or even 5-6 years ago, this would not have been very appealing. so i added some stuff to make it easier for developers to use it and for it to be used exactly how Jinja or others can be used. So it slightly varies. More features will soon be added. Cheers!

re-masashi commented 1 month ago

this is live reload friendly and offers better performance( in some cases) than Spitfire 2. Also, Spitfire 3 is fully compatible with PyPy (not thoroughly tested) and there is a plan for HPy extension. Moreover, the API for using Spitfire3 is simpler.