8000 Idea: ContainerBuilder: avoid fopen if file is in opcode cache by JanTvrdik · Pull Request #27 · nette/di · GitHub
[go: up one dir, main page]

Skip to content

Idea: ContainerBuilder: avoid fopen if file is in opcode cache#27

Closed
JanTvrdik wants to merge 1 commit intonette:masterfrom
JanTvrdik:opcache_check
Closed

Idea: ContainerBuilder: avoid fopen if file is in opcode cache#27
JanTvrdik wants to merge 1 commit intonette:masterfrom
JanTvrdik:opcache_check

Conversation

@JanTvrdik
Copy link
Contributor

Bored at school I got an idea to avoid touching disk for PHP 5.5.11+. It relies on undocumented function opcache_is_script_cached (http://stackoverflow.com/questions/23229849/opcache-is-script-cached-function-in-php5-5-11).

Not sure how to solve the atomicity. We may use @include and check return value for FALSE.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I am correct but I traced file reading back to zend_fopen_wrapper, is that the function that ultimately loads the script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea, why?

@mishak87
Copy link

For stated purpose (no disk touching) it would be necessary to use shared memory for locking ie.: shm_get_var or semaphore. It would be possible to this this on systems that have OPcache and Semaphore enabled (linux only).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0