tiddly-gittly / tw-echarts

An All-in-one Visualization Framework for TiddlyWiki5 based on ECharts
https://tiddly-gittly.github.io/tw-echarts/
MIT License
48 stars 8 forks source link

Too much call to filterTiddlers cause lagging #78

Closed linonetwo closed 1 year ago

linonetwo commented 1 year ago

It takes 2s to run on my 10k+ tiddlers

Because this will call filterTiddlers many times.

            return [yearDates.get(t).map(([e,t])=>{
                var r = $tw.wiki.filterTiddlers(getFilterByDate(t, a)).length;
                return n += r,
                [e, r]
            }
linonetwo commented 1 year ago

https://github.com/tiddly-gittly/tw-echarts/blob/d9526787ad776d0c5381e00ec3cd5bdc0ab2dd53/src/echarts/addons/Gk0Wk/GitHubHeatMap.ts#L29-L38

This .map function callback

linonetwo commented 1 year ago

before: 3s

截屏2023-02-11 23 35 51

after: 0.15s

截屏2023-02-11 23 30 55

linonetwo commented 1 year ago

https://github.com/tiddly-gittly/tw-echarts/commit/7742b9ac1aad14a53d6af3d6cf3b48b6a0f25639