Dylan Thacker-Smith
5f0b64cebc
Merge pull request #1005 from christopheraue/render_refactor
...
Refactored and optimized rendering
2018-04-19 16:44:57 -04:00
Christopher Aue
c086017bc9
refactored and optimized rendering
...
Measures:
1) A while loop is faster than iterating with #each.
2) Check string, variable and block tokens first. They are far more
frequent than interrupt tokens. In their case, checking for an
interrupt can be avoided.
3) String tokens just map to themselves and don't need the special
treatment of BlockBody#render_node (except the resource limit
check).
Benchmark
=========
$ bundle exec rake benchmark:run
Before
------
Run 1)
parse: 41.630 (± 0.0%) i/s - 420.000 in 10.089309s
render: 75.962 (± 3.9%) i/s - 763.000 in 10.066823s
parse & render: 25.497 (± 0.0%) i/s - 256.000 in 10.040862s
Run 2)
parse: 42.130 (± 0.0%) i/s - 424.000 in 10.064738s
render: 77.003 (± 1.3%) i/s - 777.000 in 10.093524s
parse & render: 25.739 (± 0.0%) i/s - 258.000 in 10.024581s
Run 3)
parse: 41.976 (± 2.4%) i/s - 420.000 in 10.021406s
render: 76.184 (± 1.3%) i/s - 763.000 in 10.018104s
parse & render: 25.641 (± 0.0%) i/s - 258.000 in 10.062549s
After
-----
Run 1)
parse: 42.283 (± 0.0%) i/s - 424.000 in 10.028306s
render: 83.158 (± 2.4%) i/s - 832.000 in 10.009201s
parse & render: 26.417 (± 0.0%) i/s - 266.000 in 10.069718s
Run 2)
parse: 41.159 (± 4.9%) i/s - 412.000 in 10.031297s
render: 81.591 (± 3.7%) i/s - 816.000 in 10.018225s
parse & render: 25.924 (± 3.9%) i/s - 260.000 in 10.035653s
Run 3)
parse: 42.418 (± 2.4%) i/s - 424.000 in 10.003100s
render: 84.183 (± 2.4%) i/s - 847.000 in 10.069781s
parse & render: 26.726 (± 0.0%) i/s - 268.000 in 10.029857s
2018-04-19 12:10:15 +02:00
Dylan Thacker-Smith
4369fe6c85
Improve the unexpected end delimiter message for block tags. ( #1003 )
2018-04-05 11:18:13 -04:00
Justin Li
c118e6b435
Merge pull request #992 from ashmaroli/each-without-index
...
Replace unnecessary Array#each_with_index with Array#each
2018-03-16 14:28:05 -04:00
Ashwin Maroli
0fbaf873d9
replace unnecessary #each_with_index with #each
2018-03-16 14:31:43 +05:30
Justin Li
5980ddbfae
Merge pull request #988 from ashmaroli/regex-to-constant
...
Assign regexps to constants
2018-03-14 16:49:17 -04:00
Ashwin Maroli
193fc0fb7a
revert to earlier regex for matching floats
2018-03-14 07:02:04 +05:30
Ashwin Maroli
e4da4d49d2
assign regex to a constant
2018-03-13 23:36:56 +05:30
Justin Li
a0bec1f873
Merge pull request #981 from nicolasleger/patch-1
...
[CI] Test against Ruby 2.5 version
2018-03-05 11:23:18 -05:00
Nicolas Leger
4aa3261518
[CI] Test against Ruby 2.5 version
2018-02-12 00:23:06 +01:00
Dylan Thacker-Smith
04d552fabb
Gemfile: Use https rather than git protocol to fetch liquid-c
2018-02-01 07:08:19 -05:00
Dylan Thacker-Smith
5106466a2d
Add a regression test for a liquid-c trim mode bug ( #972 )
2018-01-25 10:55:01 -05:00
Justin Li
5d6c1ed7c6
Merge pull request #963 from lostapathy/patch-1
...
have travis test against ruby 2.4
2017-12-15 16:53:26 -05:00
Joe Francis
a594653a0c
have travis test against ruby 2.4
2017-12-15 14:27:17 -06:00
Thibaut Courouble
0c802aba17
Merge pull request #958 from Shopify/minmax
...
Rename min/max filters for clarity
2017-12-06 11:41:12 -05:00
Thibaut Courouble
147d7ae24d
Rename min/max filters for clarity
2017-12-06 09:48:30 -05:00
Thibaut Courouble
282d42f98d
Fix min/max filters
2017-12-06 08:58:05 -05:00
Justin Li
e6ba6ee87b
Revert "Use replacement string for replace filters literally ( #924 )"
...
This reverts commit 27c91203ab .
2017-12-04 15:07:59 -05:00
Nithin Bekal
2ad7a37d44
Merge pull request #954 from Shopify/max-min-filters
...
Add max and min filters
2017-11-30 14:18:43 -05:00
Nithin Bekal
4bdaaf069f
Add max/min filters
2017-11-30 13:56:37 -05:00
Justin Li
85b1e91aed
Merge pull request #952 from Shopify/bump-rubocop
...
Bump rubocop
2017-11-22 12:44:36 -05:00
Justin Li
a7c5e247c8
Bump rubocop
2017-11-22 11:59:06 -05:00
Dylan Thacker-Smith
6c117fd7dd
refactor: Reduce maximum block nesting in Liquid::BlockBody#parse ( #944 )
2017-10-19 10:12:40 -04:00
Maxime Bedard
7d2d90d715
Merge pull request #932 from Shopify/avoid-default-values-hash
...
Avoid hash with default values due to inconsistent marshaling
2017-10-17 16:02:45 -04:00
Maxime Bedard
f761d21215
Use {} notation
2017-09-20 09:48:23 -04:00
Maxime Bedard
a796c17f8b
Avoid hash with default values due to inconsistent marshalling
2017-09-19 16:23:14 -04:00
Dylan Thacker-Smith
27c91203ab
Use replacement string for replace filters literally ( #924 )
2017-08-28 11:51:20 -04:00
Justin Li
44eaa4b9d8
Merge pull request #920 from Shopify/symbol_to_liquid
...
Support rendering symbols as strings
2017-08-18 12:10:53 -04:00
Pascal Betz
a979b3ec95
Do not raise when variable is defined but nil when using strict_variables
2017-08-18 12:09:57 -04:00
Justin Li
bf3e759da3
Support rendering symbols as strings
2017-08-17 23:10:57 -04:00
Rene
59162f7a0e
added attr_readers for collection and variable names in for tag ( #909 )
2017-07-06 09:41:48 -04:00
Thierry Joyal
c582b86f16
Merge pull request #898 from Shopify/cgi-powered-standard-filters-to-handle-non-string-inputs
...
CGI powered standard filters to handle non string inputs
2017-05-26 18:05:42 +00:00
Thierry Joyal
e340803d12
CGI powered standard filters to handle non string inputs
2017-05-25 15:53:41 +00:00
Dylan Thacker-Smith
48a6d86ac2
Use stackprof to test to lack of object allocations ( #896 )
2017-05-12 09:20:51 -04:00
Dylan Thacker-Smith
3bb29d5456
Replace assert_equal nil, with a assert_nil ( #895 )
2017-05-11 14:05:03 -04:00
Dylan Thacker-Smith
9c72ccb82f
Limit how much blocks can be nested during parsing ( #894 )
2017-05-11 09:37:53 -04:00
Dylan Thacker-Smith
62d4625468
Use a loop to strictly parse binary comparisons to avoid recursion ( #892 )
...
Using recursion allows a malicious template to cause a SystemStackError
2017-05-10 10:41:52 -04:00
Dylan Thacker-Smith
8928454e29
Use a loop to evaluate binary comparisions to avoid recursion ( #891 )
...
Using recursion allows a malicious template to cause a SystemStackError
2017-05-10 10:41:24 -04:00
Florian Weingarten
1370a102c9
Merge pull request #789 from evulse/contains-strict-fix
...
Allow variables to start with contains in strict parser
2017-03-24 09:50:31 -04:00
Mike Angell
c9bac9befe
Merge branch 'master' into contains-strict-fix
2017-03-24 11:09:09 +10:00
Mike
210a0616f3
Update History to include fix
2017-03-24 10:35:56 +10:00
Lasse Skindstad Ebert
5149cde5c3
Fix include tag used with strict_variables ( #829 )
...
Fixes https://github.com/Shopify/liquid/issues/828
2017-03-22 16:00:31 -04:00
Florian Weingarten
22f2cec5de
Merge pull request #864 from chenxianyu2015/fix-strainer-add_filter-method
...
fix #861 : duplicate inclusion condition logic error of Liquid::Strainer.add_filter method
2017-02-23 14:06:20 -05:00
chenxianyu
4318240ae0
test: modify Strainer.add_filter duplicate inclusion test case
2017-02-22 10:33:22 +08:00
chenxianyu
aa79c33dda
fix: Strainer.add_filter method
2017-02-13 15:50:19 +08:00
Justin Li
b1ef28566e
Merge pull request #846 from mrmanc/master
...
Clarifies spelling of for’s reversed flag to address #843
2017-02-10 19:26:38 -05:00
Justin Li
41bcc48222
Merge pull request #854 from jaredbeck/patch-1
...
Docs: Help people upgrade to 4, re: liquid_methods
2017-02-10 19:25:04 -05:00
Dylan Thacker-Smith
27d5106dc9
Merge pull request #860 from Shopify/handle-string-node-render-exc
...
Avoid calling line_number on String node when rescuing a render error.
2017-02-10 14:13:11 -05:00
Dylan Thacker-Smith
7334073be2
Avoid duck typing to detect whether to call render on a node.
2017-02-10 13:49:26 -05:00
Dylan Thacker-Smith
5dcefd7d77
Avoid calling line_number on String node when rescuing a render error.
2017-02-07 15:34:10 -05:00