Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pmario opened this issue May 6, 2021 · 13 comments

Comments

@pmario
Copy link
Member

pmario commented May 6, 2021

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
Copy link
Member Author

pmario commented May 6, 2021

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
Copy link
Member

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
Copy link
Member Author

pmario commented May 6, 2021

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
Copy link
Member Author

pmario commented May 6, 2021

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
Copy link
Member Author

pmario commented May 6, 2021

@saqimtiaz ... Try to recreate the MD-table show at #5674 (comment) with the output chrome gives you ;)

@saqimtiaz
Copy link
Member

saqimtiaz commented May 6, 2021

@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:

  • a tiddler that exposes the performance log to end users.
  • an option available in the Filter tab in Advanced Search when performance instrumentation is enabled, to see the performance of your filter and thus compare between different filters.
  • the ability to save the performance information in tiddlers (thus including your suggestion).

@pmario
Copy link
Member Author

pmario commented May 6, 2021

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
Copy link
Member Author

pmario commented May 6, 2021

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

@Jermolene
Copy link
Member

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
Copy link
Member Author

pmario commented May 12, 2021

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
Copy link
Member

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
Copy link
Member Author

pmario commented May 12, 2021

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?

  • I want to have full table output as shown in my early posts
    • output as raw MD syntax - so users are able to post them here
    • output as raw TW syntax - For TW documentation purpose
  • position / fromLine / toLine parameter
  • lineTemplate parameter
  • headerTemplate
  • filter ... filter "name" to be able to show only the active filter
  • class custom for TW table to allow styling eg:"even / odd"
  • every "column" should be available as a variable to be used in templates
  • values are trimmed fixed-3 and fixed-2

Advanced search

  • In the advanced search it should only show 1 filter.
    • A button execute 1x 100x 1000x ... or may be a slider 0-1000 step 100
  • Button to save the result as a new tiddler. Makes it easy to test different filters and compare them
  • So it should be easy to see what's faster
  • Reset buffer button

That's it for the moment

@pmario pmario closed this as completed Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants