From 9fc2086b71470773d5b6ac526d9df029d5eba2fc Mon Sep 17 00:00:00 2001 From: Jermolene Date: Tue, 21 Feb 2017 08:31:05 +0000 Subject: [PATCH] Optimise sameday filter I used this test: console.time();for(var t=0; t<200; t++) {$tw.wiki.filterTiddlers("[all[tiddlers+shadows]sameday[20170210]]");};c onsole.timeEnd() Before this patch, I got speeds of approx 190ms, versus 140ms afterwards. Note that the ability to add a cache property like this is only possible because tiddler objects are immutable. --- boot/boot.js | 1 + core/modules/filters/sameday.js | 7 ++----- core/modules/tiddler.js | 13 +++++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index 3a2d3d765..8a16a4077 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -827,6 +827,7 @@ taking precedence to the right */ $tw.Tiddler = function(/* [fields,] fields */) { this.fields = Object.create(null); + this.cache = Object.create(null); for(var c=0; c