Mustache benchmarks

ยอดดู 49 ครั้ง
ข้ามไปที่ข้อความที่ยังไม่อ่านรายการแรก

molte

ยังไม่อ่าน,
18 มี.ค. 2553 16:13:5418/3/53
ถึง Guardians of the Temple
Do you have any benchmarks on the Temple version of Mustache compared
to the "official" version at http://github.com/defunkt/mustache?

Magnus Holm

ยังไม่อ่าน,
18 มี.ค. 2553 16:43:0618/3/53
ถึง guardians-o...@googlegroups.com
Nope. That said, I wrote the current compiler which is used in defunkt's Mustache and the Temple version is pretty much a direct port (except that defunkt's compiles to a single, interpolated string so I expect it to be faster, if only by a fraction).

The Temple version of Mustache is actually more a proof-of-concept and will probably be removed in the future. At the moment Mustache is too simple to actually gain so much from Temple. I'm currently experimenting with compiling the core abstraction into JVM bytecode on JRuby (which hopefully should speed up rendering time). If Temple can show off such types of optimizations it's probably more tempting to write even simple template engines on top of Temple.

// Magnus Holm


On Thu, Mar 18, 2010 at 21:13, molte <mol...@gmail.com> wrote:
Do you have any benchmarks on the Temple version of Mustache compared
to the "official" version at http://github.com/defunkt/mustache?

To unsubscribe from this group, send email to guardians-of-the-temple+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Chris Wanstrath

ยังไม่อ่าน,
18 มี.ค. 2553 20:31:4118/3/53
ถึง guardians-o...@googlegroups.com
Mustache's "parser" is very naïve and can get confused in complicated
situations. I'd like to see if Temple can help out in those areas.

I've recently begun working on Mustache again and am in the process of
collecting a few test cases to begin experimenting with.

Basically, in other words, anything Magnus does that in any way
improves Mustache will be pulled into the official version because he
is awesome.

Chris

--
Chris Wanstrath
http://github.com/defunkt

Magnus Holm

ยังไม่อ่าน,
19 มี.ค. 2553 07:25:4419/3/53
ถึง guardians-o...@googlegroups.com
I think Mustache can gain more from Temple The Philosophy (keep parser/generator separated etc), than Temple The Library.

Here's a more solid Mustache parser (using StringScanner): http://gist.github.com/337428, including improved syntax error messages:

parser.rb:155:in `error': Unclosed tag (MustacheParser::SyntaxError)
  Line 1
    {{this tag only allows \w+}}
          ^

parser.rb:155:in `error': Unclosed section "testing" (MustacheParser::SyntaxError)
  Line 1
    {{#testing}}
             ^

parser.rb:155:in `error': Unclosed tag (MustacheParser::SyntaxError)
  Line 1
    {{! Comments can contain everything except newlines:
                                                       ^


// Magnus Holm

Magnus Holm

ยังไม่อ่าน,
19 มี.ค. 2553 08:02:5119/3/53
ถึง guardians-o...@googlegroups.com
Added a simple generator too: http://gist.github.com/337428 (and realized that comments can actually contain newlines).

Just `require "inject"` after Mustache is loaded, and it injects itself. When I added that to lib/mustache.rb, all tests pass except for two:

* test_unclosed_sections_reports_the_line_number (because it's "Line" and not "line" now)
* test_reports_unclosed_sections (because the class is MustacheParser::SyntaxError)

// Magnus Holm

Molte

ยังไม่อ่าน,
20 มี.ค. 2553 05:16:1220/3/53
ถึง guardians-o...@googlegroups.com
I understand. Thank you for answering.
----
Molte

CosSinCalc
http://cossincalc.com


2010/3/19 Magnus Holm <jud...@gmail.com>

Chris Wanstrath

ยังไม่อ่าน,
23 มี.ค. 2553 16:16:0423/3/53
ถึง guardians-o...@googlegroups.com
On Fri, Mar 19, 2010 at 4:25 AM, Magnus Holm <jud...@gmail.com> wrote:

> I think Mustache can gain more from Temple The Philosophy (keep
> parser/generator separated etc), than Temple The Library.
>
> Here's a more solid Mustache parser (using
> StringScanner): http://gist.github.com/337428, including improved syntax
> error messages:
>
> parser.rb:155:in `error': Unclosed tag (MustacheParser::SyntaxError)
>   Line 1
>     {{this tag only allows \w+}}
>           ^
>
> parser.rb:155:in `error': Unclosed section "testing"
> (MustacheParser::SyntaxError)
>   Line 1
>     {{#testing}}
>              ^
>
> parser.rb:155:in `error': Unclosed tag (MustacheParser::SyntaxError)
>   Line 1
>     {{! Comments can contain everything except newlines:
>                                                        ^
>
> // Magnus Holm

Wow, beautiful. I'll integrate this into Mustache proper as soon as I can.

Thanks! Mustachers the world over owe you a great debt.

Chris

Magnus Holm

ยังไม่อ่าน,
23 มี.ค. 2553 17:28:2223/3/53
ถึง guardians-o...@googlegroups.com
Not quite sure if it solves the problem you faced with the previous parser though (I don't really use Mustache), but hopefully it will be easier to fix those issues.

I'm also experimenting (in my head) with a Mustache generator with type-inference/where-the-value-comes-from-inference (so we don't need to do the slow @stack.each { }) which re-compiles itself as it knows more. It puts a few (but not too many IMO) limits on the template, but the performance would improve a lot.

// Magnus Holm


Chris Wanstrath

ยังไม่อ่าน,
25 มี.ค. 2553 19:29:0725/3/53
ถึง guardians-o...@googlegroups.com
On Tue, Mar 23, 2010 at 2:28 PM, Magnus Holm <jud...@gmail.com> wrote:

> Not quite sure if it solves the problem you faced with the previous parser
> though (I don't really use Mustache), but hopefully it will be easier to fix
> those issues.

It's awesome. Many issues have been fixed - thank you!

> I'm also experimenting (in my head) with a Mustache generator with
> type-inference/where-the-value-comes-from-inference (so we don't need to do
> the slow @stack.each { }) which re-compiles itself as it knows more. It puts
> a few (but not too many IMO) limits on the template, but the performance
> would improve a lot.

Great, can't wait to check it out.

Chris

ตอบทุกคน
ตอบกลับผู้สร้าง
ส่งต่อ
ข้อความใหม่ 0 รายการ