developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 9 years ago

Closed 9 years ago

#1388 closed enhancement (fixed)

clearstatcache() and performances

Reported by: bricet Owned by:
Priority: normal Milestone: Jelix 1.3
Component: jelix Version: trunk
Severity: normal Keywords: clearstatcache performances zone jcache jkvdb
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Jelix has to call clearstatcache() on several circumstancies.

As far as I know and on the moment when I write this ticket :

  • jZone : before a filemtime() to check if a zone's cache has reached his timeout (if any)
  • jCache and jKVDB file driver : for 2 purposes (another ticket plans to merge more or less those two functionnalities, so this may lead to just one place in the future)

According to http://www.mail-archive.com/internals@lists.php.net/msg37244.html , it seems that PHP 5.3.0 (version spotted in clearstatcache() doc) introduced 2 new optionnal arguments to clearstatcache(). In both cases where we use it, I guess we could set clear_realpath_cache to false (i.e. default value) AND call it for a particular file instead of flushing the whole cache.

I do not propose any patch as I don't remember how to handle PHP version fine.

Change History (2)

comment:1 Changed 9 years ago by bricet

I just forgot to mention that clearing the whole cache is bad for performances not only for Jelix's own calls to file_exists(), filemtime() and so on, but also for PHP's internal calls.

As an example, require_once() will trigger an lstat() on every single part of a file's path (e.g. if file path is a/b/c/d.php, it will be done on a AND a/b AND a/b/c AND a/b/c/d.php), and if cache can not be used (because it has been flushed) it can lead to quite impressive perf drawbacks ...

See http://www.mail-archive.com/internals@lists.php.net/msg37245.html

comment:2 Changed 9 years ago by laurentj

  • Milestone set to Jelix 1.3
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.