-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Возможность в значениях текстовок использовать другие ключи по аналог…
…ии с конфигом, например, 'title' => 'My title ___main___'
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69cb2e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
как идея интересно, но до сих пор смущает: будет ли польза, а вот то что для каждой текстовки ещё будет регулярка запускаться (коих немало) - нагруженность.
Может перед тем как отправить в метод:
69cb2e0#diff-0275aa66ae03035f6029dd2c29c54a50R263
сделать проверку:
чтобы запускать регулярку только в случае если есть что менять.
69cb2e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно запустить тест: посмотреть сколько раз вызывается get для главной страницы, умножить на 2 и замерить затраты на preg_match
69cb2e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
но очевидно же что в значениях это будет использоваться крайне редко поэтому ощущается необходимость в strpos, которая в любом случае менее затратна
69cb2e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не очевиден реальный размер экономии
69cb2e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
очень редко будет использоваться (как минимум пока) ссылка на другие текстовки в значении, а регулярка будет запускаться всегда для каждого значения.
регулярки более ресурсоёмкие чем быстрый strpos.
если поставить условие то для каждой текстовки будет легкая проверка чем запуск машины регулярных выражений.
69cb2e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это понятно
вопрос в том на спичках эта экономия или нет
69cb2e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
разница в скорости выполнения однозначно будет в два раза. порядки времени неизвестны