Project

General

Profile

Actions

Bug #55591

closed

Don't compute amount of seconds

Added by Ingo Schmitt almost 11 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Performance
Target version:
Start date:
2014-02-02
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

There are many places in the core where the amount of secons is computed, e.g. 24 * 3600 * 7 (7 Days). Instead of computing this for every call, the evaluated number should directly be used.

Actions #1

Updated by Christian Kuhn almost 11 years ago

-1.

The calculation is done for readability (eg. in some ext_tables.php). Those are cached anyway ...

Furthermore: PHP compiler optimizes this away anyway, and a multiplication is so quick that we REALLY should not think about optimization for this detail in a high level language like PHP. Did you measure some benefit?

Actions #2

Updated by Mathias Brodala over 10 years ago

How about a date class which defines these values as constants? The Kohana framework does something like that:

https://github.com/kohana/core/blob/3.3/master/classes/Kohana/Date.php

Thus you can just use Date::WEEK and be happy.

Actions #3

Updated by Mathias Schreiber almost 10 years ago

  • Status changed from New to Closed

internally that is a static calculation and it will become a constant anyways ;-)

Actions

Also available in: Atom PDF