Skip to content

Commit

Permalink
Merge pull request #52 from rindeal/feature/speed-optimizations
Browse files Browse the repository at this point in the history
Just some speed optimizations
  • Loading branch information
w00fz committed Sep 9, 2014
2 parents b50ec3f + ff3ebb1 commit e2021d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function reload($force = true)
{
// Build file map.
$files = $this->build();
$key = md5(serialize($files) . GRAV_VERSION);
$key = md5(json_encode($files) . GRAV_VERSION);

if ($force || $key != $this->key) {
// First take non-blocking lock to the file.
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Page/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function sortCollection(Collection $collection, $orderBy, $orderDir = 'as
{
$items = $collection->toArray();

$lookup = md5(serialize($items));
$lookup = md5(json_encode($items));
if (!isset($this->sort[$lookup][$orderBy])) {
$this->buildSort($lookup, $items, $orderBy, $orderManual);
}
Expand Down
3 changes: 2 additions & 1 deletion system/src/Grav/Common/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public function randomizeFilter($original, $offset = 0)
$random = array_slice($original, $offset);
shuffle($random);

for ($x=0; $x < sizeof($original); $x++) {
$sizeOf = sizeof($original);
for ($x=0; $x < $sizeOf; $x++) {
if ($x < $offset) {
$sorted[] = $original[$x];
} else {
Expand Down

0 comments on commit e2021d1

Please sign in to comment.