comparison piecrust/templating/jinja/extensions.py @ 989:8adc27285d93

bake: Big pass on bake performance. - Reduce the amount of data passed between processes. - Make inter-process data simple objects to make it easier to test with alternatives to pickle. - Make sources have the basic requirement to be able to find a content item from an item spec (path). - Make Hoedown the default Markdown formatter.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 19 Nov 2017 14:29:17 -0800
parents cedefb806bfd
children 1857dbd4580f
comparison
equal deleted inserted replaced
988:f83ae0a5d793 989:8adc27285d93
144 144
145 def _renderCache(self, name, caller): 145 def _renderCache(self, name, caller):
146 key = self.environment.piecrust_cache_prefix + name 146 key = self.environment.piecrust_cache_prefix + name
147 147
148 rcs = self.environment.app.env.render_ctx_stack 148 rcs = self.environment.app.env.render_ctx_stack
149 rdr_pass = rcs.current_ctx.current_pass_info 149 ri = rcs.current_ctx.render_info
150 150
151 # try to load the block from the cache 151 # try to load the block from the cache
152 # if there is no fragment in the cache, render it and store 152 # if there is no fragment in the cache, render it and store
153 # it in the cache. 153 # it in the cache.
154 pair = self.environment.piecrust_cache.get(key) 154 pair = self.environment.piecrust_cache.get(key)
155 if pair is not None: 155 if pair is not None:
156 rdr_pass.used_source_names.update(pair[1]) 156 ri['used_source_names'].update(pair[1])
157 return pair[0] 157 return pair[0]
158 158
159 prev_used = rdr_pass.used_source_names.copy() 159 prev_used = ri['used_source_names'].copy()
160 rv = caller() 160 rv = caller()
161 after_used = rdr_pass.used_source_names.copy() 161 after_used = ri['used_source_names'].copy()
162 used_delta = after_used.difference(prev_used) 162 used_delta = after_used.difference(prev_used)
163 self.environment.piecrust_cache[key] = (rv, used_delta) 163 self.environment.piecrust_cache[key] = (rv, used_delta)
164 return rv 164 return rv
165 165
166 166