Skip to content

Commit

Permalink
Add performance section
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Sep 11, 2023
1 parent c406736 commit eb89d47
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,19 @@ $ composer require ray/aop ~2.0

## パフォーマンス

AOP
AOPクラスのコンパイルにより、Ray.Aopは高速に動作します。アノテーションの読み込みは初回コンパイル時のみなので、ランタイムのパフォーマンスに影響を与えません。開発段階や最初の実行時にも、ファイルのタイムスタンプを利用してPHPファイルがキャッシュされ、通常はアノテーション生成のコストを気にする必要はありませんが、アプリケーションのブートストラップでアノテーションリーダーの設定を行うことで、初回コンパイル時のパフォーマンスが向上します。特に大規模なアプリケーションでこの設定は役立ちます。

### APCu

```php
SevericeLocator::setReader(new PsrCachedReader(new Reader(), $apcuCache));
```

### アトリビュートのみ使用(推奨)

```php
SevericeLocator::setReader(new AttributeReader);`
```

## DI Framework

Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,22 @@ The recommended way to install Ray.Aop is through [Composer](https://github.com/
$ composer require ray/aop ^2.0
```

## Performance

Compilation of the AOP class allows Ray.Aop to run faster. Annotations are only loaded at first compile time, so they do not affect runtime performance. During the development phase and even at first runtime, PHP files are cached using the file timestamps, so normally you do not need to worry about the cost of annotation generation, but by setting up an annotation reader in the application bootstrap, first-time compile time performance. This setting is especially useful for large applications.

### APCu

```php
SevericeLocator::setReader(new PsrCachedReader(new Reader(), $apcuCache));
```

### PHP8 attributes only (recommended)

```php
SevericeLocator::setReader(new AttributeReader);`
```

## Integrated DI framework

* See also the DI framework [Ray.Di](https://github.com/ray-di/Ray.Di) which integrates DI and AOP.
Expand Down

0 comments on commit eb89d47

Please sign in to comment.