Skip to content

Conversation

iluuu1994
Copy link
Member

@iluuu1994 iluuu1994 commented Jul 4, 2020

There have been quite a few JIT benchmarks lately. It would be interesting to know how many functions actually make use of the JIT in large repositories. This PR track successes and failures and returns them in opcache_get_status. Naming is a little verbose, let me know if that's ok. Also, it would obviously be more useful if we knew which functions failed compiling but that would probably be too expensive. This PR might be too simplistic, let me know if there's something I didn't handle properly.

/ping @dstogov

@iluuu1994
Copy link
Member Author

Nevermind, ran it through a project with all of the vendors, this is the result.

["function_compilation_successes"]=>
int(53779)
["function_compilation_failures"]=>
int(0)

In other words, not a single failure 👍

@iluuu1994 iluuu1994 closed this Jul 4, 2020
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

Keeping number of compiled/aborted functions per process doesn't make a lot of sense.
These information should be kept in shared memory and updated under lock.

Independently, it makes sense to add logging about function compilation failures, controlled by opcache.jit_debug flag (similar to traces).

memset(JIT_G(bad_root_cache_stop), 0, sizeof(JIT_G(bad_root_cache_count)));
JIT_G(bad_root_slot) = 0;
JIT_G(function_compilation_successes) = 0;
JIT_G(function_compilation_failures) = 0;
Copy link
Member

Choose a reason for hiding this comment

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

This is not specific to tracing JIT. It would be better to move this assignments to zend_jit.c


uint32_t function_compilation_successes;
uint32_t function_compilation_failures;

Copy link
Member

Choose a reason for hiding this comment

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

jit_globals structure is not shared across processes, so each process is going to keep (and show) only it's own number of compiled and failed functions.

@iluuu1994
Copy link
Member Author

Thanks Dmitry, then I will pick this back up when I'm done with my other tasks for PHP 8.0.

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