SlideShare una empresa de Scribd logo
1 de 114
Building a J-Meter
With Generators and Pipelines in PHP
by Dan Leech
@dantleech
g
b
PHPBench
/**
* @Revs(1000)
* @Iterations(10)
*/
class HashingBench
{
public function benchMd5()
{
md5('hello world');
}
public function benchSha1()
{
sha1('hello world');
}
}
No way to interpolate tests
Three Benchmarks
Linear Execution
Linear Execution
Interpolated Execution
The results are now consistently inconsistent
PHPBench will report a high standard deviation, and you will
know to start again.
We want more
● Concurrent scheduling (load tests)
● Parameter / data generation
● HTTP sampling
● Even better progress loggers
Can I do this with Iterators?
Can I do this with Generators?
Generators
PHP 5.5.0
20 June 2013
Generators are Iterators
interface Iterator extends Traversable {
public function current();
public function next();
public function key();
public function valid();
public function rewind();
}
class PointlessIterator implements Iterator {
private $array;
public function __construct(array $array) {
$this->array = $array;
}
function rewind() {
return reset($this->array);
}
function current() {
return current($this->array);
}
function key() {
return key($this->array);
}
function next() {
return next($this->array);
}
function valid() {
return key($this->array) !== null;
}
$pointless = [ 'a' => 1, 'b' => 2 ];
$pointless = new ArrayIterator($pointless);
foreach ($pointless as $key => $value) {
echo "$key = $value";
}
// outputs
// a = 1
// b = 2
Generators are easy Iterators
That you cannot rewind
But that's OK, because they do cool stuff
final class Generator implements Iterator {
function rewind() {}
function valid() {}
function current() {}
function key() {}
function next() {}
function send($value) {}
function throw(Exception $exception) {}
function getReturn() {}
}
final class Generator implements Iterator {
function rewind() {}
function valid() {}
function current() {}
function key() {}
function next() {}
function send($value) {}
function throw(Exception $exception) {}
function getReturn() {}
}
Iterator
final class Generator implements Iterator {
function rewind() {}
function valid() {}
function current() {}
function key() {}
function next() {}
function send($value) {}
function throw(Exception $exception) {}
function getReturn() {}
}
Generator
YIELD
function numbers(): Generator
{
yield "1";
yield "2";
yield "3";
}
var_dump(numbers() instanceof Iterator);
// true
foreach (numbers() as $number) {
echo $number;
}
// 123
$generator = new ArrayIterator([1, 2, 3]);
foreach (numbers() as $number) {
echo $number;
}
// 123
Yielding control
<?php
function lines($fileName)
{
$h = fopen($fileName, 'r');
$lines = [];
while (false !== $line = fgets($h)) {
$lines[] = $line;
}
fclose($h);
return $lines;
}
foreach (lines() as $line) {
echo $line;
}
<?php
function lines($fileName)
{
$h = fopen($fileName, 'r');
while (false !== $line = fgets($h)) {
yield $line;
}
fclose($h);
}
$generator = lines();
foreach ($generator as $line) {
echo $line;
// do something else
}
Generators make functions interruptible
final class Generator implements Iterator {
function rewind() {}
function valid() {}
function current() {}
function key() {}
function next() {}
function send($value) {}
function throw(Exception $exception) {}
function getReturn() {}
}
Generator
send()
send()
function myGenerator(): Generator
{
$data = yield;
yield $data;
}
echo myGenerator()->send('Goodbye');
// Goodbye
Fast forwards to first yield returns
the sent value
send()
<?php
function echoGenerator(): Generator
{
$data = yield;
$data = yield $data;
}
$generator = echoGenerator();
var_dump($generator->send('Hello'));
var_dump($generator->send('Goodbye'));
var_dump($generator->send('Adios'));
send()
string(5) "Hello"
NULL
NULL
throw()
throw()
function myGenerator(): Generator
{
try {
yield;
} catch (MyException $e) {
echo 'Hello!';
}
}
echo myGenerator()->throw(new MyException());
Exception thrown here
invalid generator
function myGenerator(): Generator
{
try {
yield;
} catch (MyException $e) {
echo 'Hello!';
}
}
$generator = myGenerator();
$generator->next();
echo myGenerator()->throw(new MyException());
Exception thrown here
getReturn()
getReturn
<?php
function hello(): Generator
{
yield 'hello';
yield 'goodbye';
return 'ciao';
}
$generator = hello();
echo $generator->getReturn();
PHP Fatal error: Uncaught Exception: Cannot get
return value of a generator that hasn't returned
getReturn
<?php
function hello(): Generator
{
yield 'hello';
yield 'goodbye';
return 'ciao';
}
$generator = hello();
$generator->next()
$generator->next();
echo $generator->getReturn ();
// ciao
Generators will not return the return value
Unless you call getReturn()
After the generator has returned
Asynchronous Operations
Async Operations
function requestUrl($url): Generator {
$process = new Process("curl -I $url");
$process->start();
while ($process->isRunning()) {
echo $url . "n";
yield false;
}
yield $process->getOutput();
}
Async Operations
$generators = [
requestUrl('https://inviqa.com'),
requestUrl('https://bbc.co.uk'),
];
while ($generators) {
foreach ($generators as $i => $gen) {
if (false !== $result = $gen->current()) {
var_dump($result);
}
$task->next();
if (false === $gen->valid()) {
unset($generators[$i]);
}
}
}
https://www.inviqa.com
https://www.inviqa.com
http://www.bbc.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
http://www.bbc.com
https://www.inviqa.com
string(344) "HTTP/1.1 301 Moved Permanently
Date: Tue, 20 Feb 2018 21:21:23 GMT
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Tue, 20 Feb 2018 22:21:23 GMT
Location: http://inviqa.com/
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-
cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 3f0483ebdb3a2d6b-TXL
string(612) "HTTP/1.1 200 OK
Server: Apache
Content-Type: text/html
Expires: Tue, 20 Feb 2018 21:21:32 GMT
Content-Language: en
Etag: "25e4bf9a0519a562c8fb0a6379044365"
X-PAL-Host: pal143.back.live.telhc.local:80
Content-Length: 209756
Date: Tue, 20 Feb 2018 21:21:23 GMT
Connection: keep-alive
Set-Cookie: BBC-
UID=055ac8cca981056306da9a3821c959a1b1d799b4875494361aa037e2fe86c6080curl/7.55.1;
expires=Sat, 19-Feb-22 21:21:23 GMT; path=/; domain=.bbc.com
Cache-Control: private, max-age=60
X-Cache-Action: HIT
X-C"...
Go and look at event loops
AMP
Amp is a non-blocking concurrency
framework for PHP. It provides an event
loop, promises and streams as a base for
asynchronous programming.
Promises in combination with generators
are used to build coroutines, which allow
writing asynchronous code just like
synchronous code, without any callbacks.
https://github.com/amphp/amp
AMP
Amp is a non-blocking concurrency
framework for PHP. It provides an event
loop, promises and streams as a base for
asynchronous programming.
Promises in combination with generators
are used to build coroutines, which allow
writing asynchronous code just like
synchronous code, without any callbacks.
https://github.com/amphp/amp
Infinite Potential
while (true)
<?php
function numbers($number = 0): Generator
{
while (true) {
yield $number++;
}
}
foreach (numbers() as $number) {
echo $number . ' ';
}
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
107 108 109 110 111 112 113 114 115 116 117 118 ...
The number of iterations is no longer the concern
of the generator
Recursion
function myGenerator(): Generator
{
$count = yield;
while (true) {
$count = $count * 2;
$count = yield $count;
}
}
$generator = myGenerator();
$count = 1;
while (true) {
$count = $generator->send($count);
}
Pipelines
A pipeline is a sequence of stages.
Each stage has a specific job to do.
1)Make each program do one thing well. To do a new job, build afresh
rather than complicate old programs by adding new "features".
2)Expect the output of every program to become the input to another, as yet
unknown, program. Don't clutter output with extraneous information. Avoid
stringently columnar or binary input formats. Don't insist on interactive
input.
3)Design and build software, even operating systems, to be tried early,
ideally within weeks. Don't hesitate to throw away the clumsy parts and
rebuild them.
4)Use tools in preference to unskilled help to lighten a programming task,
even if you have to detour to build the tools and expect to throw some of
them out after you've finished using them.
Unix Philosophy
1)Make each program do one thing well. To do a new job, build afresh
rather than complicate old programs by adding new "features".
2)Expect the output of every program to become the input to another, as yet
unknown, program. Don't clutter output with extraneous information. Avoid
stringently columnar or binary input formats. Don't insist on interactive
input.
3)Design and build software, even operating systems, to be tried early,
ideally within weeks. Don't hesitate to throw away the clumsy parts and
rebuild them.
4)Use tools in preference to unskilled help to lighten a programming task,
even if you have to detour to build the tools and expect to throw some of
them out after you've finished using them.
Unix Philosophy
Unix Pipes
$ echo '<?php echo "hello";' | php
hello
This is a simple phraze this is
Spell Checker
$ echo 'This is a a simple phraze this is'
Command
Output
This
is
a
simple
phraze
this
is
Spell Checker
$ echo 'This is a simple phraze this is' |
words
Command
Output
this
is
a
simple
phraze
this
is
Spell Checker
$ echo 'This is a simple phraze' |
words |
lowercase
Command
Output
a
is
is
phraze
simple
this
this
Spell Checker
$ echo 'This is a simple phraze' |
words |
lowercase |
sort
Command
Output
a
is
phraze
simple
this
Spell Checker
$ echo 'This is a simple phraze' |
words |
lowercase |
sort |
unique
Command
Output
phraze
Spell Checker
$ echo 'This is a simple phraze' |
words |
lowercase |
sort |
unique |
mismatch dictionary.txt
Command
Output
GNU is not Unix
Unix GNU
words fmt -1
lowercase tr '[:upper:]' '[:lower:]'
sort sort
unique uniq
mismatch dictionary.txt comm -23 - dictionary.txt
Working together + Specialisation
Pipelines in PHP
Input
Callable
Stage
Output
Stage
Stage
Input
Callable
Callable
Output
Callable
Callable function ($value) { return $value * 2; }
10
20
function ($value) { return $value +1; }
21
function ($value) { return $value * 2; }
42
$pipeline = (new Pipeline)
->pipe(function ($value) {
return $value * 2;
})
->pipe(function ($value) {
return $value +1;
})
->pipe(function ($value) {
return $value * 2;
})
;
$pipeline->process(10);
class TimesTwoStage {
public function __invoke($value) {
return $value * 2;
}
}
class AddOneStage {
public function __invoke($value) {
return $value + 1;
}
}
$pipeline = (new Pipeline)
->pipe(new TimeTwoStage())
->pipe(new AddOneStage())
->pipe(new TimeTwoStage());
$pipeline->process(10);
Stages can be Generators
function Stage1(): Generator
{
$payload = yield;
while (true) {
$data = yield data;
}
}
Let's build a thing!
● Performance Testing
● Load Testing
● Acceptance Testing
● Cache Testing
In the beginning there was the
Test Plan
Samplers
<update screenshots , samplers should be
introduced before threads>
Threads
a.k.a Users
Variables
Assertions
Live Reports
Let's Build a J-Meter
with Generators and Pipelines
in PHP
Blog Posts
●
https://nikic.github.io/2012/12/22/Cooperative-multitasking-using-coroutines-in-
PHP.html
● https://blog.ircmaxell.com/2012/07/what-generators-can-do-for-you.html
●
https://speakerdeck.com/chrispitt/cooperative-multitasking-with-generators
– https://www.youtube.com/watch?v=cY8FUhZvK7w
● https://medium.com/@aaronweatherall/the-pipeline-pattern-for-fun-and-profit-
9b5f43a98130
●
https://www.cise.ufl.edu/research/ParallelPatterns/PatternLanguage/Algorithm
Structure/Pipeline.htm
● https://markbakeruk.net/2016/01/19/a-functional-guide-to-cat-herding-with-php-
generators/
●
http://sergeyzhuk.me/2018/02/15/amp-coroutines/
Videos
● Cooperative multitasking with Generators:
https://www.youtube.com/watch?v=cY8FUhZvK7w
● Pushing the limits of PHP with React:
https://www.youtube.com/watch?
v=fQxxm4vD8Ok&feature=youtu.be
● Herding Cats: https://vimeo.com/189755262
● What the heck is the event loop anyway?:
https://www.youtube.com/watch?v=8aGhZQkoFbQ
Thanks

Más contenido relacionado

La actualidad más candente

PHP traits, treat or threat?
PHP traits, treat or threat?PHP traits, treat or threat?
PHP traits, treat or threat?
Nick Belhomme
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
Deepak Singh
 

La actualidad más candente (20)

GNU Parallel
GNU ParallelGNU Parallel
GNU Parallel
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
PhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginPhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 Plugin
 
Damien seguy php 5.6
Damien seguy php 5.6Damien seguy php 5.6
Damien seguy php 5.6
 
PHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedPHP 8.1 - What's new and changed
PHP 8.1 - What's new and changed
 
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyoエラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
 
Mastering Namespaces in PHP
Mastering Namespaces in PHPMastering Namespaces in PHP
Mastering Namespaces in PHP
 
PHP traits, treat or threat?
PHP traits, treat or threat?PHP traits, treat or threat?
PHP traits, treat or threat?
 
InterConnect: Server Side Swift for Java Developers
InterConnect:  Server Side Swift for Java DevelopersInterConnect:  Server Side Swift for Java Developers
InterConnect: Server Side Swift for Java Developers
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
 
Flying under the radar
Flying under the radarFlying under the radar
Flying under the radar
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
 
Python Programming Essentials - M17 - Functions
Python Programming Essentials - M17 - FunctionsPython Programming Essentials - M17 - Functions
Python Programming Essentials - M17 - Functions
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Construire son JDK en 10 étapes
Construire son JDK en 10 étapesConstruire son JDK en 10 étapes
Construire son JDK en 10 étapes
 
C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)
 
Php Debugger
Php DebuggerPhp Debugger
Php Debugger
 
OSCON - ES6 metaprogramming unleashed
OSCON -  ES6 metaprogramming unleashedOSCON -  ES6 metaprogramming unleashed
OSCON - ES6 metaprogramming unleashed
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Cocoa heads 09112017
Cocoa heads 09112017Cocoa heads 09112017
Cocoa heads 09112017
 

Similar a Incredible Machine with Pipelines and Generators

Similar a Incredible Machine with Pipelines and Generators (20)

Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
 
Diving into HHVM Extensions (Brno PHP Conference 2015)
Diving into HHVM Extensions (Brno PHP Conference 2015)Diving into HHVM Extensions (Brno PHP Conference 2015)
Diving into HHVM Extensions (Brno PHP Conference 2015)
 
PHP and COM
PHP and COMPHP and COM
PHP and COM
 
Introduction to web and php mysql
Introduction to web and php mysqlIntroduction to web and php mysql
Introduction to web and php mysql
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbai
 
The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)
 
Guidelines php 8 gig
Guidelines php 8 gigGuidelines php 8 gig
Guidelines php 8 gig
 
Java 8 - Lambdas and much more
Java 8 - Lambdas and much moreJava 8 - Lambdas and much more
Java 8 - Lambdas and much more
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7
 

Más de dantleech

Más de dantleech (7)

2019 11-bgphp
2019 11-bgphp2019 11-bgphp
2019 11-bgphp
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)
 
Phpactor and VIM
Phpactor and VIMPhpactor and VIM
Phpactor and VIM
 
A Tale of Three Components
A Tale of Three ComponentsA Tale of Three Components
A Tale of Three Components
 
Boltc CMS - a really quick overview
Boltc CMS - a really quick overviewBoltc CMS - a really quick overview
Boltc CMS - a really quick overview
 
Tmux quick intro
Tmux quick introTmux quick intro
Tmux quick intro
 
Benchmarking and PHPBench
Benchmarking and PHPBenchBenchmarking and PHPBench
Benchmarking and PHPBench
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Incredible Machine with Pipelines and Generators

Notas del editor

  1. This talk is - Mainly about Generators - Slightly about Pipelines and J-Meter - Creating a cool tool
  2. I was on the bench at the beginning of this month. I was wondering what to do Then I remembered that I always intended to make PHPBench better...
  3. - Explain better what this does - Why are you doing things with hashes
  4. Composition Making a system
  5. Iterators rotate
  6. Generators can pass values to each other while rotating
  7. - array - everybody knows - iterable, traversable you cannot implement
  8. - Iterators can have state - Get values from a database - Generate values
  9. Same as passing [1,2,3] to the built in array-iterator (next slide)
  10. Control is being passed from the generator to the for loop
  11. - Value is returned by yield -
  12. - What is going to happen here - Value is returned by yield
  13. - Value is returned by yield -
  14. &amp;lt;REVIEW!!&amp;gt;
  15. - *PHP is async* - Replace somethingElse (AccessDatabase, concurrent HTTP requests).
  16. - *PHP is async* - Replace somethingElse (AccessDatabase, concurrent HTTP requests).
  17. Generators can be chained to each other
  18. Cut down on the instructional quality of this section.