performance1Add my vote for this tag create new tag
, view all tags
This is a place to brainstorm on better performance, to present and argue and link ideas for improving the performance of the TWiki core. Ideas can range from technical Perl-geek ideas through to marketing ideas that just make it seem better. Let your creativity loose! Cut the fat!

PerlGeek ideas

  1. The biggest chunk of time used in an unaccelerated apache server (one without ModPerl or SpeedyCGI) is taken up in loading code and BEGIN blocks. If there was less code to load, it would load faster. So, reduce the amount of code, by moving costly features like %TOC% out to a plugin.
  2. Move locale and regexp initialisation in TWikiDotPm into BEGIN (see LocationLocationLocation)
  3. Reduce the amount of code compiled on startup by using lazy loading techniques like autosplit.
  4. The biggest chunk of time taken in displaying a simple topic is in variable expansion. This is because there are a lot of variables, and every one is s///ed into the text, even if it isn't there. So, turn variable expansion on it's head, and only expand variables that are actually found in the text i.e. s/%([A-Z][A-Z0-9_]*)%/&expandVariable($1)/ge. Note that this requires a standard for variables that is currently only loosely enforced.
  5. Reduce the amount of code compiled by identifying and refactoring out common code.
  6. Remove dead code such as mirrorcache.
  7. Cache topic reads, so no topic is read more than once.
  8. Move "variables" that don't ever, or rarely, get expanded from TWikiPreferences to TWiki.cfg.
    • Export useful variables from twiki.cfg in a hash like the regex hash.

Architectural ideas

  1. Reading and writing text files takes a huge chunk of time. Store topics in a database instead.
  2. Reorganise modules so that rarely used functions are compiled only when required.
  3. Identify and propagate a TopicObjectModel - reduces code duplication, .

Marketing ideas

  1. Ship with plugins installed but not enabled. That way the new installation seems really fast, and the local installer is aware that they will slow it down by enabling plugins.
  2. Disable permissions on the release, require them to be explicitly enabled by the installer.

Societal Ideas

  1. Steer the focus in twiki.org away from features. For example, this topic is classified as "FeatureBrainstorming" - there is no classification for anything else. See AntiFeature.


-- CrawfordCurrie - 07 Sep 2004

I have used TWiki a long time, but did not know there were performance issues until I installed the new release and a couple of weeks later the sysadmin for my Univ called and complained that I was slowing down the whole University system. I looked into it and I found I was being mercilessly pounded by web robots that would hit every single link on every single page. Fixing robots.txt to block them from doing anything may help, but robots can ignore that. I think the only truly effective thing is to only show the links like "edit", "attach" "diff" and so forth to authenticated users. Also, anything that looks like a link which results in a search should be redone. If you don't show those links, the robot can't find them, right? So, instead of a link to WebIndex, one is smarter to tell people how they can type in the URL command that leads to WebIndex. I've also made the meta robots tag include noindex,nofollow and I fiddled UI/View.pm so that the meta robots tag is shown on all pages. If the Univ makes me remove TWiki because of CPU time, it would be a disaster. So I kill all robots.

Next, concentrate on the cost of things TWiki actually does. It "seems," from watching system output, that some things are especially costly. rdiff appears oppressive. Any view that requires a search is expensive. Views of ordinary saved text files don't seem so bad.

Do you think these guesses are correct? I'm fighting for the life of 3 beautiful little TWikis here.

-- PaulJohnson - 19 Oct 2004

ImprovePerformanceByInlineCode - Take the code that normally gets called seperately, insert in the code in the right place and then just run without any conditional execution/etc.

-- MattWilkie - 23 Feb 2005

Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2005-02-23 - MattWilkie
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.