On this page:
3.1 Optimizing renders
3.1.1 Use raco make on your templates
3.1.2 Example benchmarks
8.12

3 raco beeswax render🔗ℹ

This command renders a Pollen source (or any file that provides Pollen’s standard identifiers doc and metas) using the appropriate Beeswax template.

Use raco beeswax render in preference to raco pollen render when you want speed over convenience. This command is stupid but fast.

> raco beeswax render source ...

As with Pollen:

Unlike Pollen:

3.1 Optimizing renders🔗ℹ

3.1.1 Use raco make on your templates🔗ℹ

You will get a noticeable speed increase by precompiling your Beeswax template with raco make:

> raco make template.html.rkt

This will speed things up no matter what method you use to apply your Beeswax templates — whether that is raco beeswax render, Pollen, or some custom scheme of your own.

Perhaps Beeswax will do this for you at some point, but for now, it doesn’t. You can either do it manually, or automate it along with the rest of your build by using a makefile.

3.1.2 Example benchmarks🔗ℹ

Here we compare three render times for the same source document: one using Pollen (with a Pollen template), one using raco beeswax render, and another using raco beeswax render with a precompiled template. The source document and Pollen and Beeswax templates used are the same ones shown in the tutorial.

The commands shown are actually run each time this documentation is built, so the time measurements reflect the performance of whatever environment was used to built this copy of this document.

If you are viewing this document from a local Racket installation, these are your computer’s numbers! They depend not only on the hardware, but also the nature of other workloads running at the same time in that environment. The times reflected on docs.racket-lang.org are generally going to be slower than those measured on your local computer.

# Reset the compile cache

> raco pollen reset

pollen: resetting cache ...

 

# "Preheat the cache"

> raco pollen setup

pollen: preheating cache ...

pollen: caching: fleas.html.pm

 

# Pollen render (without the Beeswax external-renderer)

> raco pollen render fleas.html

pollen: rendering fleas.html

pollen: rendering /fleas.html.pm

pollen: rendered /fleas.html (309 ms)

 

# Beeswax render

> raco beeswax render fleas.html.pm

beeswax: rendered /fleas.html.pm → /fleas.html (54ms)

 

# Make Beeswax go even faster by precompiling the template

> raco make template.html.rkt

 

> raco beeswax render fleas.html.pm

beeswax: rendered /fleas.html.pm → /fleas.html (52ms)