Mercurial > piecrust2
comparison piecrust/page.py @ 440:32c7c2d219d2
performance: Refactor how data is managed to reduce copying.
* Make use of `collections.abc.Mapping` to better identify things that are
supposed to look like dictionaries.
* Instead of handling "overlay" of data in a dict tree in each different data
object, make all objects `Mapping`s and handle merging at a higher level
with the new `MergedMapping` object.
* Since this new object is read-only, remove the need for deep-copying of
app and page configurations.
* Split data classes into separate modules.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 28 Jun 2015 08:22:39 -0700 |
parents | e7b865f8f335 |
children | 96d363e2da4b |
comparison
equal
deleted
inserted
replaced
439:c0700c6d9545 | 440:32c7c2d219d2 |
---|---|
282 content = parse_segments(raw, offset) | 282 content = parse_segments(raw, offset) |
283 config.set('segments', list(content.keys())) | 283 config.set('segments', list(content.keys())) |
284 | 284 |
285 # Save to the cache. | 285 # Save to the cache. |
286 cache_data = { | 286 cache_data = { |
287 'config': config.get(), | 287 'config': config.getAll(), |
288 'content': json_save_segments(content)} | 288 'content': json_save_segments(content)} |
289 cache.write(cache_path, json.dumps(cache_data)) | 289 cache.write(cache_path, json.dumps(cache_data)) |
290 | 290 |
291 return config, content, False | 291 return config, content, False |
292 | 292 |