Hi Tony, I think it depends, what your macros do. .. Eg. If they define global functionality, which is useful for every "user" tiddler, or used in the ViewTemplate, you pretty much have to make them global, tagging them $:/tags/Macro
If you use them in something like a Dashboard tiddler, it can make sense, to \import them in the Dashboard itself. .. It limits the scope of the macros, so you won't have problems with "name collisions", which can be an issue for global macros. There are some differences in macro/variable lookup performance, but I think you can safely ignore them. If your application uses a filter somewhere, they will outweight the js macro/variable lookup by far. JS variable lookup is highly optimized by browsers. ------------- I personally have several macro definitions in 1 tiddler. IMO this makes debugging much easier. It also makes it easier to convert a macro definition tiddler into a template, which isn't tagged or imported at, but transcluded. Transcluding macros uses more memory, since every transclusion defines new macro variables. Calling those macros = variables, has a very minimal performance advantage, since the variable lookup is faster. ... BUT every transclusion needs time to build those variables. ... So in the end the penalties will compensate the advantages. Global macros are imported in $:/core/ui/PageTemplate ... So those variables will only be built, if the page template or one of the macros are changed. $:/tags/Macro/View variables will be built everytime the ViewTemplate is shown. On the other hand you can use the same macro name per tiddler view. This gives you the possibility to change macro behavior per tiddler view in the story river. So again ... It depends, on what you want to do. ... I think $:/tags/Macro/View is only needed for very special cases. I would go with a global macro definition. It makes them simple to use. ------------- Having every macro in 1 tiddler can improve the possibility to document them. The text below a macro definitions is ignored by the \import process. So it doesn't have any memory or performance penalty if there is a lot of text there. But .. I personally think, it makes debugging more complex. Adding comments like <!-- comment --> inside the macro body, _will_ negatively impact macro performance, since the comment is processed everytime the macro is executed. (... we should try to improve this ) The [tag[abcd]] filter index does speed up finding tiddlers tagged "abcd" quite a bit. So yes. \import filter is improved since the indexing exists. In 5.1.22 there have also been some improvements, with internal variable handling, which has improved macro handling. Just some thoughts have fun! mario -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d161e4eb-95eb-45e8-aacb-ef88678d7ba9%40googlegroups.com.

