Radius 0.6.0 - My Take
Message from 2022
This post is pretty old! Opinions and technical information in it are almost certainly oudated. Commands and configurations will probably not work. Consider the age of the content before putting any of it into practice.
Radius is “powerful tag-based templates,” or in layman’s terms, it’s safe templates for Ruby that look like HTML.
<pre><code><ul>
<g:stooge>
<li><g:name /></li>
</g:stooge>
</ul>
</code></pre>
Radius 0.5.2 kind of sucked though. The more params you had on tags, the slower it got:
bryce@bryce-imac ~/Desktop> ruby slowre.rb
user system total real
0 0.000000 0.000000 0.000000 ( 0.000048)
1 0.000000 0.000000 0.000000 ( 0.000074)
2 0.000000 0.000000 0.000000 ( 0.000111)
3 0.000000 0.000000 0.000000 ( 0.000248)
4 0.000000 0.000000 0.000000 ( 0.000393)
5 0.000000 0.000000 0.000000 ( 0.000685)
6 0.000000 0.000000 0.000000 ( 0.001415)
7 0.000000 0.000000 0.000000 ( 0.002887)
8 0.010000 0.000000 0.010000 ( 0.004921)
9 0.010000 0.000000 0.010000 ( 0.009326)
10 0.020000 0.000000 0.020000 ( 0.019066)
11 0.030000 0.000000 0.030000 ( 0.034845)
12 0.070000 0.000000 0.070000 ( 0.075393)
13 0.140000 0.000000 0.140000 ( 0.141817)
14 0.310000 0.000000 0.310000 ( 0.313445)
15 0.470000 0.000000 0.470000 ( 0.477277)
16 1.080000 0.010000 1.090000 ( 1.100431)
17 2.130000 0.000000 2.130000 ( 2.145870)
18 4.520000 0.010000 4.530000 ( 4.551257)
19 8.710000 0.030000 8.740000 ( 8.809107)
20 18.210000 0.060000 18.270000 ( 18.760486)
21 37.330000 0.120000 37.450000 ( 38.078883)
22 72.180000 0.220000 72.400000 ( 73.730274)
23 164.220000 0.430000 164.650000 ( 167.151136)
24 297.360000 0.820000 298.180000 ( 302.562118)
25 604.980000 1.510000 606.490000 ( 613.877121)
26 1186.090000 3.760000 1189.850000 ( 1208.670618)
27 2637.850000 5.210000 2643.060000 ( 2656.108351)
28 5002.200000 9.120000 5011.320000 ( 5029.671745)
29 10078.680000 18.950000 10097.630000 (10136.826513)
30 20596.300000 37.680000 20633.980000 (20707.061331)
31
(left column is number of params)
Since our big app at work uses Radius not just as user->system templating code, but as system->system processing code, we were generating Radius tags with forty params, which Radius’s regex would have taken about eight months to chew up.
So I rewrote it, in Ragel which is just flat out nicer. Instead of dealing with a regex, you’re describing a state machine; they both get turned into NFAs in the end.
Looks like the gem hasn’t built yet on github, so if you want it you’ll have to build it yourself (it’ll be bkerley-radius-0.6.0 when it does go). I’ll try to edit this post when it’s available.