Re: [PHP-DEV] Re: Multi-level Caching Fork of OPcache -- update

2013-06-11 Thread Terry Ellison

On 10/06/13 09:20, Dmitry Stogov wrote:

Sorry for slow response.
I'm very busy with other work and have no time for MLC OPcache review.
I don't think we can include it into main tree before 5.5.0 release 
anyway.

But in general I think we may include your work in the future releases.

Also, thanks for useful reports about problems you've found in OPcache :)

Thanks. Dmitry.


Dmitry,

One useful side-effect of writing the MLC support is that I've really 
had to take apart the core OPcache code to understand how it works.  
It's probably the first in-depth review that this extension has had from 
someone _outside_ the Zend team, so its only to be expected that anyone 
doing this would find a few issues.


What I do think needs to be said it that I think that you guys have done 
a fantastic job here in this development.  9 times out of 10 when I've 
initially thought why didn't they do it this way? when digging into 
the code, I've dug down in and discovered that you already had, or had 
approached it a better way.  IMO, the whole OPcache approach is tighter 
and more sound than that of APC.  Take one example of this: the 2-pass 
algo for compiled scripts which enables the storage for a compiled 
script be to allocated as a single storage unit.  This has two major 
performance benefits at runtime:


1)  The memory allocator overheads of preparing scripts for execution 
(and deallocation at rundown) are reduced by more than an order of 
magnitude.
2)  The memory needed to execute the script is in a contiguous memory 
areas, and this gives improved hardware (as in L1/L2/L3) caching which 
passes through to a runtime performance improvement.


There are a couple of things that I would refactor if I had written 
OPcache.  (I'll raise a couple of issues on these to discuss what I mean 
in more depth.  and when the MLC work reaches a plateau if you think its 
worthwhile I can cut a couple of branches to show you a possible solution.)

A)  The SMA startup bootstrap is just messy and needs refactoring.
B)  The simple dead-and-rebirth method of refreshing caches isn't going 
to scale well on real systems.


Terry
(Note the new email addr that I am using for php.net work, as this one 
isn't being blocked by the php.net server)


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] php extension about php_stream_fopen_tmpfile()

2013-06-11 Thread Bleakwind
I write a php extension.
How can I user Zend API do that?
where can I find some doc about file_handle-handle ?

ZEND_API zend_op_array *(*org_compile_file)(zend_file_handle *file_handle,
int type TSRMLS_DC);
ZEND_API zend_op_array *sead_compile_file(zend_file_handle *file_handle,
int type TSRMLS_DC)
{
php_stream *stream;
char *data_decode;
int data_decode_len;

/* ... */

/* Zend API Begin: This unsuccessful */
php_stream *tmpstream;
if ((tmpstream = php_stream_fopen_tmpfile()) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to create
temporary file.  Check permissions in temporary files directory.);
php_stream_close(stream);
return org_compile_file(file_handle, type TSRMLS_CC);
}
numbytes = php_stream_write(tmpstream, data_decode, data_decode_len);
if (numbytes != data_decode_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Only %d of %d bytes
written, possibly out of free disk space, numbytes, data_decode_len);
numbytes = -1;
}
php_stream_rewind(tmpstream);
/* Zend API End */

/* C Begin: This is OK */
FILE *tmpstream;
tmpstream = tmpfile();
fwrite(data_decode, data_decode_len, 1, tmpstream);
rewind(tmpstream);
/* C End */

file_handle-handle.fp = tmpstream;
file_handle-type = ZEND_HANDLE_FP;
file_handle-opened_path = expand_filepath(file_handle-filename, NULL
TSRMLS_CC);

return org_compile_file(file_handle, type TSRMLS_CC);
}


Re: [PHP-DEV] Internal object orientation documentation available!

2013-06-11 Thread Lars Strojny
Thank you, thank you, thank you all!

Am 10.06.2013 um 20:33 schrieb Nikita Popov nikita@gmail.com:

 Hi internals!
 
 We just published some rather extensive documentation on internal object
 orientation:
 
http://www.phpinternalsbook.com/classes_objects.html
 
 This is part of a larger project aimed at documenting the engine and making
 it accessible to new contributors.
 
 Any feedback is appreciated!
 
 Thanks,
 Nikita


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Internal object orientation documentation available!

2013-06-11 Thread guilhermebla...@gmail.com
Nikita,

That's f*ckin' awesome. Thanks a lot!!!

Cheers,


On Tue, Jun 11, 2013 at 1:56 PM, Lars Strojny l...@strojny.net wrote:

 Thank you, thank you, thank you all!

 Am 10.06.2013 um 20:33 schrieb Nikita Popov nikita@gmail.com:

  Hi internals!
 
  We just published some rather extensive documentation on internal object
  orientation:
 
 http://www.phpinternalsbook.com/classes_objects.html
 
  This is part of a larger project aimed at documenting the engine and
 making
  it accessible to new contributors.
 
  Any feedback is appreciated!
 
  Thanks,
  Nikita


 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Guilherme Blanco
MSN: guilhermebla...@hotmail.com
GTalk: guilhermeblanco
Toronto - ON/Canada


Re: [PHP-DEV] Internal object orientation documentation available!

2013-06-11 Thread Ivan Enderlin @ Hoa

Hi Nikita,

Thank you (and Julien and Anthony) for this book. Really appreciated!


On 10/06/13 20:33, Nikita Popov wrote:

Hi internals!

We just published some rather extensive documentation on internal object
orientation:

 http://www.phpinternalsbook.com/classes_objects.html

This is part of a larger project aimed at documenting the engine and making
it accessible to new contributors.

Any feedback is appreciated!

Thanks,
Nikita



--
Ivan Enderlin
Developer of Hoa
http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Internal object orientation documentation available!

2013-06-11 Thread Michael Wallner
On 10 June 2013 20:33, Nikita Popov nikita@gmail.com wrote:
 Hi internals!

 We just published some rather extensive documentation on internal object
 orientation:

 http://www.phpinternalsbook.com/classes_objects.html

 This is part of a larger project aimed at documenting the engine and making
 it accessible to new contributors.

 Any feedback is appreciated!

That looks awesome; just asking: why didn't it go into http://php.net/internals?


--
Regards,
Mike

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php