Open
Conversation
bcmod returns a float, which isn't type-juggled to an int in PHP 7.2
Uses hand-written pure PHP base-change algorithm
Owner
|
Hi Michael Thank you very much. This is awesome and very much appreciated. I'll go over the code over the next couple of weeks - hopefully this weekend. I'm very much up for going ahead with a v2.0 release which has a minimum PHP version requirement of 7.x (which version exactly, I'm happy to discuss). There are many good reasons to do this. I will, however, cherry pick b2d6dc1 into the v1.1 branch, event though it isn't a PHP 5.x problem, it makes sense to me. Anyway, great work, and I'll be back in touch soon. Cheers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
In the course of my day job, I needed to add base58 support but could not use the
bcmathorgmpmodules. To support that I wrote a pure PHP service.To work with our environment I had to make a couple of changes to support PHP 7.2
Deficiencies
I'm aware it has (at least) the following issues:
PHPServiceupdates from PHP 7.2 compatibility updatesbut I wanted to get discussion started so I can avoid repeating any other mistakes I have made
Performance
According to the included benchmarks, on my machine the pure PHP implementation is actually faster than the
bcmathimplementation:I have an idea that this is at least partially because I do a direct base change from 256 to 58, while the included services do 256->10->58 instead. I envision experimenting with altering the
bcmathandgmpalgorithms similarly to see if they also speed up.