TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.97k stars 1.18k forks source link

[IDEA] Filter Performance $tw.perf.createTiddler() shows data as a table in a tiddler #5674

Closed pmario closed 1 year ago

pmario commented 3 years ago

Hi folks, I did create a POC, with which you can create a tiddler like this.

grafik

The call is: $tw.perf.createTiddler(<fromLine>, <toLine>, <fullRes>) ... There could be a better name!

fromLine starts at: 0 toLine is default 1000 ... and it is "inclusive". fullRes: will show the full values. They are "fixed" by default.

There will be an option: create markdown table syntax, which should make it easy to copy the content here into a github issue.

IMO it makes the performance data much more accessible. The call is still depending on the dev console, but the data can be exported easily.

@Jermolene, @saqimtiaz ... What do you think?

pmario commented 3 years ago

A MD table where you can easily copy paste content

Pos Filter Invoke Average Total %
0 [is[tiddler]] -[[$:/core]] -[[$:/library/sjcl.js]] -[prefix[$:/boot/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/isEncrypted]] -[prefix[$:/status/]] -[prefix[$:/state/]] -[prefix[$:/temp/]] 18 1.556 28 32.18
1 [all[tiddlers+shadows]tag[$:/tags/MenuBar]] -[all[tiddlers+shadows]prefix[$:/config/plugins/menubar/MenuItems/Visibility/]regexp:text[hide]removeprefix[$:/config/plugins/menubar/MenuItems/Visibility/]] -[all[tiddlers+shadows]tag[$:/tags/TopLeftBar]limit[1]then[]else[$:/plugins/tiddlywiki/menubar/items/topleftbar]] -[all[tiddlers+shadows]tag[$:/tags/TopRightBar]limit[1]then[$:/plugins/tiddlywiki/menubar/items/toprightbar]] -$:/plugins/tiddlywiki/menubar/items/hamburger +[limit[1]] 4 2.500 10 11.49
2 [all[system+tiddlers]tag[systemConfig]limit[1]] 4 1.000 4 4.60
3 [all[shadows+tiddlers]prefix[$:/language/Docs/Types/]get[name]length[]maxall[]] 4 0.750 3 3.45
4 [all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]] 8 0.375 3 3.45
5 [[$:/config/OriginalTiddlerPaths]getindex] 2 1.500 3 3.45
saqimtiaz commented 3 years ago

I can see utility in this for making it easier to compare performance with different settings/code. I'm not opposed to the idea if the implementation is relatively light weight in terms of adding to file size.

However, do note that at least on Chrome there are pretty good affordances for saving logged data from the console to file, or copying to the clipboard.

pmario commented 3 years ago

However, do note that at least on Chrome there are pretty good affordances for saving logged data from the console to file, or copying to the clipboard.

I did try with Edge, and had no luck. .. With FF you can copy a line-separated list, with which I did start. But having access to the raw data really nice. ...

I not happy with timestamps like this.

grafik

pmario commented 3 years ago

I can see utility in this for making it easier to compare performance with different settings/code. I'm not opposed to the idea if the implementation is relatively light weight in terms of adding to file size.

At the moment it's about 100 lines, including empty lines and no code optimization. ...

pmario commented 3 years ago

@saqimtiaz ... Try to recreate the MD-table show at https://github.com/Jermolene/TiddlyWiki5/issues/5674#issuecomment-833488716 with the output chrome gives you ;)

saqimtiaz commented 3 years ago

@pmario I've already stated that I see value in your suggestion. I've also expressed a concern - one that matters more to some of us than others - about adding to the file size for something that will be used quite rarely and primarily or almost entirely by developers. I would rather not argue over the value-cost proposition in that as it is unlikely to be productive.

The underlying issue is that we could make the performance information (especially for filters) more accessible, especially to non-developers who may wish to optimize their wikis. While a developer could still work with the console or run your code via a bookmarklet etc, this isn't an accessible option for most users who do not have a technical background. I think this is particularly important since most of the complex and well made editions of TiddlyWiki that we see today are made by layman users who would not feel comfortable using the browser console. We need to make it easier for people working just with wikitext to use the performance instrumentation.

So how about this for a suggestion for the kind of feature that I believe would add real value for end users:

pmario commented 3 years ago

You are right, improving the accessibility should be a goal.


I did do some tests, especially with eachday and sameday, which are used in the recent tab.

I did find some optimizations wikitext wise. But the biggest improvements can be made, if some core functions are changed. And they have a great effect if you have 5000 to 10000+ tiddlers.

Playing with filters, it's easy to "waste" hours, with not much effect, without changing the underlying core functions.

pmario commented 3 years ago

But what we can already see with my examples here. The new "menubar" plugin contains some problematic filters, that "have room for improvements".

Jermolene commented 3 years ago

Thanks @pmario I concur with @saqimtiaz here. Put another way, the fact that performance metrics are only available via the console is a fairly serious shortcoming, so we should fix that rather than trying to improve workflows based on the current console-based arrangements.

pmario commented 3 years ago

I do have a widget in the works, that should allow us to add it to the advanced search filter tab. I will create a new PR soon.

Jermolene commented 3 years ago

I do have a widget in the works, that should allow us to add it to the advanced search filter tab. I will create a new PR soon.

Please can you explain what you're planning before making the PR?

pmario commented 3 years ago

I do have a widget in the works, that should allow us to add it to the advanced search filter tab. I will create a new PR soon.

Please can you explain what you're planning before making the PR?

Advanced search

That's it for the moment

pmario commented 1 year ago

Closed in favour of: https://evidentlycube.github.io/TW5-PluginShowcase/#Advanced%20Performance GH: https://github.com/EvidentlyCube/TW5-PluginShowcase/tree/main/plugins/EvidentlyCube/TW5-AdvancedPerformance