Repository navigation
Vector range() and linspace() optimizations #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <?php | ||
|
|
||
| namespace Tensor\Benchmarks\Factories; | ||
|
|
||
| use Tensor\Vector; | ||
| use Generator; | ||
|
|
||
| /** | ||
| * @Groups({"Factories"}) | ||
| */ | ||
| class VectorLinspaceBench | ||
| { | ||
| /** | ||
| * @return list<array{size: int}> | ||
| */ | ||
| public function sizes() : Generator | ||
| { | ||
| yield 'small' => ['size' => 1024 * 1024]; | ||
| yield 'medium' => ['size' => 4096 * 4096]; | ||
| } | ||
|
|
||
| /** | ||
| * @Subject | ||
| * @Iterations(5) | ||
| * @ParamProviders({"sizes"}) | ||
| * @OutputTimeUnit("milliseconds", precision=3) | ||
| * @param array $params | ||
| */ | ||
| public function linspace(array $params) : void | ||
| { | ||
| Vector::linspace(0.0, 1000.0, $params['size']); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <?php | ||
|
|
||
| namespace Tensor\Benchmarks\Factories; | ||
|
|
||
| use Tensor\Vector; | ||
| use Generator; | ||
|
|
||
| /** | ||
| * @Groups({"Factories"}) | ||
| */ | ||
| class VectorRangeBench | ||
| { | ||
| /** | ||
| * @return list<array{size: int}> | ||
| */ | ||
| public function sizes() : Generator | ||
| { | ||
| yield 'small' => ['size' => 1024 * 1024]; | ||
| yield 'medium' => ['size' => 4096 * 4096]; | ||
| } | ||
|
|
||
| /** | ||
| * @Subject | ||
| * @Iterations(5) | ||
| * @ParamProviders({"sizes"}) | ||
| * @OutputTimeUnit("milliseconds", precision=3) | ||
| * @param array $params | ||
| */ | ||
| public function range(array $params) : void | ||
| { | ||
| Vector::range(0.0, (float) $params['size'], 1.0); | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.