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

Install {8,16,32}Bits_Quotient kernel funcs as methods #2616

Merged
merged 1 commit into from
Jul 5, 2018

Conversation

fingolfin
Copy link
Member

@fingolfin fingolfin commented Jul 4, 2018

This is an alternative to #2615.

Note that some benchmarks indicate that these kernel functions do provide a noticeable speed up: (here x32 and u32 are defined in tst/testinstall/wordrep.tst):

gap> GASMAN("collect"); for i in [1..1000000] do x:=x32/u32; od; time;
1542
gap> GASMAN("collect"); for i in [1..1000000] do x:=x32/u32; od; time;
1475
gap> GASMAN("collect"); for i in [1..1000000] do x:=32Bits_Quotient(x32,u32); od; time;
91
gap> GASMAN("collect"); for i in [1..1000000] do x:=32Bits_Quotient(x32,u32); od; time;
87

But I wonder if there is a reason they were not used?

Resolves #2504. Closes #2615.

@fingolfin fingolfin added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label Jul 4, 2018
@codecov
Copy link

codecov bot commented Jul 4, 2018

Codecov Report

Merging #2616 into master will decrease coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2616      +/-   ##
==========================================
- Coverage   74.81%    74.8%   -0.01%     
==========================================
  Files         479      479              
  Lines      242190   242190              
==========================================
- Hits       181184   181176       -8     
- Misses      61006    61014       +8
Impacted Files Coverage Δ
lib/wordrep.gi 66.61% <ø> (ø) ⬆️
src/iostream.c 62.35% <0%> (-1.15%) ⬇️
hpcgap/lib/hpc/stdtasks.g 63.93% <0%> (-1.03%) ⬇️
src/stats.c 89.41% <0%> (-0.2%) ⬇️

@fingolfin
Copy link
Member Author

@hulpke This is the alternative PR which tests 32Bit_Quotient and shows that it provides a performance boost.

Copy link
Contributor

@ThomasBreuer ThomasBreuer left a comment

Choose a reason for hiding this comment

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

The comment which I had added to the first relevant method installation holds also for the other method installations.
As soon as this comment has been addressed, I will approve the pull request.

lib/wordrep.gi Outdated
"for two 8 bits assoc. words",
IsIdenticalObj,
[ Is8BitsAssocWord, Is8BitsAssocWord ], 0,
8Bits_Quotient );
Copy link
Contributor

Choose a reason for hiding this comment

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

This method would be applicable also to elements of, for example, FreeMonoid( IsSyllableWordsFamily, 2 ),
with the effect that corrupted objects arise.
If IsMultiplicativeElementWithInverse is required for the second argument then this cannot happen,
and one can use InstallMethod instead of InstallOtherMethod.

@fingolfin
Copy link
Member Author

@ThomasBreuer Thank you! I just updated the PR based on your comments

@markuspf
Copy link
Member

markuspf commented Jul 5, 2018

I think we should keep the functions and install them as methods, i.e. I prefer this PR over #2615

@fingolfin fingolfin merged commit c27fca3 into gap-system:master Jul 5, 2018
@fingolfin fingolfin deleted the mh/use-Bits_Quotient branch July 5, 2018 12:11
@fingolfin fingolfin added the release notes: added PRs introducing changes that have since been mentioned in the release notes label Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants