Skip to content

Avoid unnecessary number initializations in BCMath #14104

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

Merged
merged 1 commit into from
May 1, 2024

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented May 1, 2024

Since freeing can deal with NULL, we can avoid calling bc_init_num and avoid resetting the number during parsing.

Using benchmark from #14076.

Before:

1.544440984726
2.0288550853729
2.092139005661

After:

1.5324399471283
1.9081380367279
2.065819978714

Since freeing can deal with NULL, we can avoid calling bc_init_num and
avoid resetting the number during parsing.

Using benchmark from php#14076.

Before:
```
1.544440984726
2.0288550853729
2.092139005661
```

After:
```
1.5324399471283
1.9081380367279
2.065819978714
```
@SakiTakamachi
Copy link
Member

Since result is mostly released during processing, a similar approach might be possible.

However, since the number of files to be changed is large, I think it would be better to make a separate PR.

@nielsdos
Copy link
Member Author

nielsdos commented May 1, 2024

Since result is mostly released during processing, a similar approach might be possible.

However, since the number of files to be changed is large, I think it would be better to make a separate PR.

Right, that would be a bit harder too.

@nielsdos nielsdos merged commit a66439a into php:master May 1, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants