{"action":"created","issue":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1864","labels_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1864/labels{/name}","comments_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1864/comments","events_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1864/events","html_url":"https://github.com/Jermolene/TiddlyWiki5/issues/1864","id":93135010,"number":1864,"title":"Improve rendering performance","user":{"login":"Jermolene","id":174761,"avatar_url":"https://avatars.githubusercontent.com/u/174761?v=3","gravatar_id":"","url":"https://api.github.com/users/Jermolene","html_url":"https://github.com/Jermolene","followers_url":"https://api.github.com/users/Jermolene/followers","following_url":"https://api.github.com/users/Jermolene/following{/other_user}","gists_url":"https://api.github.com/users/Jermolene/gists{/gist_id}","starred_url":"https://api.github.com/users/Jermolene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jermolene/subscriptions","organizations_url":"https://api.github.com/users/Jermolene/orgs","repos_url":"https://api.github.com/users/Jermolene/repos","events_url":"https://api.github.com/users/Jermolene/events{/privacy}","received_events_url":"https://api.github.com/users/Jermolene/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/labels/improvement","name":"improvement","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-07-05T18:47:05Z","updated_at":"2015-07-08T22:37:50Z","closed_at":null,"body":"The TiddlyWiki 5 rendering process is still too slow in some situations. Using the Chrome profiler, I've identified and fixed some of the bottlenecks.\r\n\r\nBackground: I've been doing some work with a dataset of 1,200 tiddlers with 6,800 distinct tags. The test process was to enable performance instrumentation in `startup.js`, and import the dataset as a JSON file. I then switched to the \"More\" tab (to cause a refresh including the contents of the \"Tags\" tab, which is highly resource intensive to compute), and noted the overall main refresh time.\r\n\r\nUsing an empty 5.1.9, I recorded refresh times of approximately 25 seconds. With the improvements discussed before, the time fell to around 10 seconds.\r\n\r\nThe initial optimisations are:\r\n\r\n* Refactored implementation of `$tw.utils.each` so that it can be optimised (previously, it was marked by Chrome as not being optimisable)\r\n* More efficient implementation of the `tags` filter operator\r\n* More efficient implementations of `parseWhitespace` and `skipWhitespace` in the parser\r\n* Use caching in `wiki.getTiddlerData` so that the data doesn't need to be re-extracted if the tiddler hasn't changed\r\n\r\nI intend to do more investigation.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/comments/119750949","html_url":"https://github.com/Jermolene/TiddlyWiki5/issues/1864#issuecomment-119750949","issue_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1864","id":119750949,"user":{"login":"sukima","id":70075,"avatar_url":"https://avatars.githubusercontent.com/u/70075?v=3","gravatar_id":"","url":"https://api.github.com/users/sukima","html_url":"https://github.com/sukima","followers_url":"https://api.github.com/users/sukima/followers","following_url":"https://api.github.com/users/sukima/following{/other_user}","gists_url":"https://api.github.com/users/sukima/gists{/gist_id}","starred_url":"https://api.github.com/users/sukima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sukima/subscriptions","organizations_url":"https://api.github.com/users/sukima/orgs","repos_url":"https://api.github.com/users/sukima/repos","events_url":"https://api.github.com/users/sukima/events{/privacy}","received_events_url":"https://api.github.com/users/sukima/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T22:37:50Z","updated_at":"2015-07-08T22:37:50Z","body":"> One could imagine creating a widget that asynchronously rendered its children.\r\n\r\nAlthough a noble idea, I can not think of a generic way to do this. The concept of asynchronous rendering in JavaScript is that each computation is deferred via a `setTimeout`. In the case of a wrapped widget the only computational unit would be the full synchronous rendering of the children under it and it wouldn't buy you much (thanks to the way JS implements *pseudo-asynchronicity*).\r\n\r\nThe only way this would add value would be if every widget supported incremental rendering that could be managed in an asynchronous way. This would probably radically change / augment the current Widget API.\r\n\r\n> A good candidate for an asynchronous operation is performing a static HTML export of all tiddlers; it takes tens of seconds for tw5.com.\r\n\r\nOh that a good one. I like asynchronous JS code challenges. Perhaps that's something I could look into this weekend. (My only want would be to have Promises available in TiddlyWiki; Will have to make due with callbacks)."}}