mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-03 07:18:06 +00:00
Performance optimisations
In some situations, I’m seeing x2.5 speedups with these optimisations Starts fixing #1864
This commit is contained in:
@@ -621,18 +621,20 @@ exports.getTiddlerData = function(titleOrTiddler,defaultData) {
|
||||
tiddler = this.getTiddler(tiddler);
|
||||
}
|
||||
if(tiddler && tiddler.fields.text) {
|
||||
switch(tiddler.fields.type) {
|
||||
case "application/json":
|
||||
// JSON tiddler
|
||||
try {
|
||||
data = JSON.parse(tiddler.fields.text);
|
||||
} catch(ex) {
|
||||
return defaultData;
|
||||
}
|
||||
return data;
|
||||
case "application/x-tiddler-dictionary":
|
||||
return $tw.utils.parseFields(tiddler.fields.text);
|
||||
}
|
||||
return this.getCacheForTiddler(tiddler.fields.title,"data",function() {
|
||||
switch(tiddler.fields.type) {
|
||||
case "application/json":
|
||||
// JSON tiddler
|
||||
try {
|
||||
data = JSON.parse(tiddler.fields.text);
|
||||
} catch(ex) {
|
||||
return defaultData;
|
||||
}
|
||||
return data;
|
||||
case "application/x-tiddler-dictionary":
|
||||
return $tw.utils.parseFields(tiddler.fields.text);
|
||||
}
|
||||
});
|
||||
}
|
||||
return defaultData;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user