Skip to content
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

performance regression for Core.Intrinsicts.rem_float in 1.8/1.9 #46467

Closed
lmiq opened this issue Aug 23, 2022 · 9 comments · Fixed by #47501
Closed

performance regression for Core.Intrinsicts.rem_float in 1.8/1.9 #46467

lmiq opened this issue Aug 23, 2022 · 9 comments · Fixed by #47501
Labels
kind:regression Regression in behavior compared to a previous version performance Must go faster

Comments

@lmiq
Copy link
Contributor

lmiq commented Aug 23, 2022

I noticed this in the use of mod, but it seems that the issue can be tracked down to Core.Intrinsics.rem_float:

On 1.8.0:

julia> @btime Core.Intrinsics.rem_float(x, 1.0) setup=(x=rand())
  7.422 ns (0 allocations: 0 bytes)
0.11718355488076748

On 1.7.3:

julia> @btime Core.Intrinsics.rem_float(x, 1.0) setup=(x=rand())
  2.208 ns (0 allocations: 0 bytes)
0.21209837479215266

This is causing a significant performance regression in a package of mine which uses mod many many times.

system info:

Linux m3g 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

edit: on the nightly build:

julia> @btime Core.Intrinsics.rem_float(x, 1.0) setup=(x=rand())
  7.414 ns (0 allocations: 0 bytes)
0.2578476302582853
@giordano giordano added performance Must go faster kind:regression Regression in behavior compared to a previous version labels Aug 23, 2022
@oscardssmith
Copy link
Member

Is this a difference in which libm we call?

@lmiq
Copy link
Contributor Author

lmiq commented Aug 24, 2022

I noticed now that similar performance regressions can be felt in the floor, trunc and other functions of this family.

@oscardssmith
Copy link
Member

that's unsurprising but quite bad.

@oscardssmith oscardssmith changed the title performance regression for Core.Intrinsicts.rem_float in 1.8 performance regression for Core.Intrinsicts.rem_float in 1.8/1.9 Aug 24, 2022
@oscardssmith
Copy link
Member

Also, this affects 1.9 as well.

@gbaraldi
Copy link
Member

gbaraldi commented Nov 7, 2022

Was this a change in our side? Did we change from system libm to Openlibm or something like it?

@oscardssmith
Copy link
Member

yeah we're hitting the openlibm one now. The ideal fix would be to move this to pure Julia but I doubt I'll get around to it.

@gbaraldi
Copy link
Member

gbaraldi commented Nov 7, 2022

Could we port this algorithm. It doesn't seem too too complicated. And license wise it would be fine I guess.

@oscardssmith
Copy link
Member

want to take a crack at it?

@gbaraldi
Copy link
Member

gbaraldi commented Nov 7, 2022

Sure, I'll try it out, see how it compares :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:regression Regression in behavior compared to a previous version performance Must go faster
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants