-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented protobuf extension #7964
base: master
Are you sure you want to change the base?
Conversation
@fredemmott @mxw Can you help review this extension? |
I'm not going to be able to look at this really. That said:
|
also cc @binliu19 |
Just FYI, I actually haven't been able to make any progress on that and because the pure-PHP Protobuf library works on HHVM (I've been maintaining it for HHVM compat and merging patches in the latest protobuf master as needed) so we haven't prioritized work on it. The JIT optimizes the pure-PHP Protobuf library pretty well but I'm sure this C implementation would still be several ms faster. Since this is the furthest implementation of protobuf for HHVM, I would be happy to help test it and what not @huzhiguang Also, are there any preferences about contributing this to the google/protobuf repository versus baked directly in HHVM? It would be nice if it was just built in directly but if it was merged in to the google repo it would probably get more maintenance. Thoughts? |
Also, I just looked through and this seems to only implement a smalls subset of the Protobuf extension. Is that correct? |
Are there significant advantages to having an extension for this instead of using the PHP library? In many cases, C++ extensions end up being slower than JITed PHP. |
Ah interesting; The main performance problem we see in the PHP Protobuf library (without JIT) is that for every single request these functions listed here are called over and over again and are very expensive: https://github.com/google/protobuf/search?l=PHP&q=initOnce%28&type=&utf8=%E2%9C%93 With the JIT on these become significantly faster but there is still an impact. I think the Protobuf PHP C extension actually only initializes those things once for the duration of the PHP process daemon rather than for every request |
Test data proves that C extension performance is better than php jited extension |
Leaving the bulk for others (and I'll follow-up to make sure that happens). Performance comparisons against a more recent version would likely be useful,
Remove from zend/, put in slow/ |
I will follow this comparison test and give the data.
I will modify the code and PR it to you |
@binliu19 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary:
Implemented protobuf extension.
php extension git address:https://github.com/allegro/php-protobuf
Generate php protobuf files you need to run using HHVM,e.g:
hhvm protoc-gen-php.php foo.proto