diff --git a/posts/html-composer.html b/posts/html-composer.html index db92b30..1682b04 100644 --- a/posts/html-composer.html +++ b/posts/html-composer.html @@ -24,8 +24,8 @@ I like writing Perl, I want to write Perl, so when I have to switch contexts to HTML it annoys me. To compound this problem, I just got off a project that used a tool called hiccup, hiccup let me write code in its native toungue (Clojure), and get back HTML in the form of a string. This rocked! Not only did I not have to write HTML, it was actually intuitive, it provided me with a DSL for HTML. So I took this idea, and ported it to Perl, in the form of - HTML::Composer. HTML::Composer is a library that does its best to emulate that sort of intuitiveness, and to my surprise, - it seems to. + HTML::Composer. HTML::Composer is a library that does its best to emulate that sort of intuitiveness, inside of Perl. To my surprise + it seems to, and even more suprisingly, it performs incredibly well.

HTML::Composer

@@ -66,10 +66,10 @@ my $html = $h->partial([ ] ]); -say $html; +say $html; # <div>Hello, World!<a href="https://www.google.com"< ...

- Since HTML::Composer operates inside of Perl data structures, and doesn't need to parse HTML, it's quite fast. Faster than any other HTML templating library I could find. + Since HTML::Composer operates inside of Perl data structures, and doesn't need to do any string parsing, it's quite fast. Faster than any other templating library outputting HTML I could find. The following benchmark is the average of five different one-hundred-million iteration runs rendering a medium sized HTML page that changed between iterations, with the caveat being, each of these libraries was expected to take an input scalar and output to a scalar variable (Text::Xslate is optimized to read from a file not a string, so it hated this benchmark):