serenity icon indicating copy to clipboard operation
serenity copied to clipboard

AK: Make StringUtils to_int a bit faster

Open Hendiadyoin1 opened this issue 3 years ago • 3 comments

AK: Add a max_digits field to NumericLimits

This field describes the maximum amount of digits a number of that type can have in the decimal system. The fromular used is:

len(str(2**n -1))

LibLine: Use to_int instead of to_uint for time_t's

time_t is technically signed and this will allow us to make to_int and to_uint more restrictive

AK: Make to_int_* and to_uint_* functions more restrictive

AK: Do range checks earlier in to_[u]int

This avoids use of __builtins and speeds up the code by up to 10%. This also adds a more turned down version of the benchmark used to measure the speedup.

Hendiadyoin1 avatar Oct 01 '22 09:10 Hendiadyoin1

I think I have a solution, although it did cost a surprising amount of runtime....

Hendiadyoin1 avatar Oct 01 '22 13:10 Hendiadyoin1

As far as I could tell all of CI caught it

Hendiadyoin1 avatar Oct 01 '22 14:10 Hendiadyoin1

As far as I could tell all of CI caught it

Ah sorry I didn't check the CI before, good to know!

davidot avatar Oct 01 '22 14:10 davidot

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Nov 05 '22 05:11 stale[bot]

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

stale[bot] avatar Nov 12 '22 06:11 stale[bot]