rfc:fiber
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:fiber [2018/04/18 22:36] – lvht | rfc:fiber [2018/06/10 13:54] – lvht | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2017-09-13 | * Date: 2017-09-13 | ||
* Author: Haitao Lv< | * Author: Haitao Lv< | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 82: | Line 82: | ||
=== Implementation Detail === | === Implementation Detail === | ||
In our simple implementation, | In our simple implementation, | ||
- | |||
- | Backup/ | ||
- | |||
- | Martin Schröder is working on this at https:// | ||
- | |||
- | ^Property^Full stack Fiber^Zend stack Fiber^ | ||
- | |Code Base|c & asm|c| | ||
- | |Minimum Memory Usage|VM stack only (4 KB)|VM & C stack (4 KB + 4 KB)| | ||
- | |Supported Architecturs|any platform|x86 at this time| | ||
- | |Yield in Internal Function|unsupported|supported| | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 117: | Line 107: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
+ | < | ||
+ | Martin Schröder is working on this at https:// | ||
+ | |||
+ | And here is the comparison. | ||
+ | ^Property^Stackless Fiber^Native Fiber^ | ||
+ | |1 Minimum Memory Usage|VM stack only (4 KB)|VM & C stack (4 KB + 4 KB)| | ||
+ | |2 Supported Architecturs|any platform|x86 at this time| | ||
+ | |3 Yield in Internal Function|unsupported|supported| | ||
+ | |4 Yield in Iterator|unsupported|supported| | ||
+ | |||
+ | Stackless fiber use less memory and are not platform-dependend (1 & 2) which makes them very portable and efficient. They do however lack support for anything that involves internal function calls (3) including opcode handlers (4, e.g. foreach loop). | ||
+ | |||
+ | Native fibers are very platform-dependend (2) and use more memory because they do need to allocate a C call stack (1). While memory allocation will be done using mmap() it will still reserve virtual memory (can be problematic for a large number of fibers on 32 bit systems due to limited virtual memory addressing). The big advantage is that all kinds of internal function call (3 & 4) are supported without any changes to the existing codebase. | ||
+ | |||
< | < | ||
Line 124: | Line 128: | ||
Both Ruby's Fiber and Lua's coroutine using the same **resume()** API to **init** and **resume** their coroutine. | Both Ruby's Fiber and Lua's coroutine using the same **resume()** API to **init** and **resume** their coroutine. | ||
- | |||
- | < | ||
- | |||
- | Introducing new keywords will cause BC impact. Both Ruby's Fiber and Lua's coroutine does not have such keyword as well. | ||
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== | ||
Line 133: | Line 133: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | This sections details areas where the feature might be improved | + | |
+ | Syntax like async/await can be implemented | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
2/3+1 voting majority | 2/3+1 voting majority | ||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/fiber.txt · Last modified: 2018/06/12 07:40 by krakjoe