Title: bpo-41513: Improve order of adding fractional values. Improve variable names. by rhettinger · Pull Request #22368 · python/cpython · GitHub
Open Graph Title: bpo-41513: Improve order of adding fractional values. Improve variable names. by rhettinger · Pull Request #22368 · python/cpython
X Title: bpo-41513: Improve order of adding fractional values. Improve variable names. by rhettinger · Pull Request #22368 · python/cpython
Description: Improve the variable names and optimize the order that the fractional components are added together. Gives a slight improvement in speed and a minor improvement in accuracy. Baseline timing: $ pytime -s 'from math import pi, hypot, e, tau' 'hypot(pi, e)' 5000000 loops, best of 11: 83.6 nsec per loop $ pytime -s 'from math import pi, hypot, e, tau' 'hypot(pi, e, tau)' 5000000 loops, best of 11: 89.1 nsec per loop $ pytime -s 'from math import pi, hypot, e, tau' 'hypot(pi, e, tau, e)' 5000000 loops, best of 11: 98.4 nsec per loop Timing with PR: $ pytime -s 'from math import pi, hypot, e, tau' 'hypot(pi, e)' 5000000 loops, best of 11: 83.1 nsec per loop $ pytime -s 'from math import pi, hypot, e, tau' 'hypot(pi, e, tau)' 5000000 loops, best of 11: 89.1 nsec per loop $ pytime -s 'from math import pi, hypot, e, tau' 'hypot(pi, e, tau, e)' 5000000 loops, best of 11: 96 nsec per loop Accuracy tests. n is the number of dimensions followed by the weighted average number of correct bits (higher is better). The list contains counts for number of bits of error (lower counts are better). hypot12 is the baseline and hypot15 is the new code: n=2 108.94 hypot12 [(104, 465), (105, 9650), (106, 74210), (107, 177328), (108, 220778) n=2 109.12 hypot15 [(104, 76), (105, 6170), (106, 65987), (107, 163375), (108, 206841) n=3 108.48 hypot12 [(103, 8), (104, 486), (105, 13420), (106, 93712), (107, 229769), (108, 243386) n=3 108.72 hypot15 [(104, 102), (105, 7086), (106, 82426), (107, 208486), (108, 230416) n=5 108.17 hypot12 [(103, 11), (104, 1353), (105, 18261), (106, 123382), (107, 253589), (108, 250362) n=5 108.40 hypot15 [(104, 174), (105, 10427), (106, 108216), (107, 232246), (108, 243693) n=10 107.97 hypot12 [(103, 33), (104, 3417), (105, 33754), (106, 150365), (107, 261133), (108, 237118) n=10 108.18 hypot15 [(103, 5), (104, 653), (105, 24797), (106, 132075), (107, 243443), (108, 238205) n=20 107.92 hypot12 [(102, 1), (103, 193), (104, 3811), (105, 39405), (106, 153847), (107, 263381), (108, 234462) n=20 108.10 hypot15 [(103, 59), (104, 2030), (105, 29794), (106, 136819), (107, 247027), (108, 238805) n=50 107.69 hypot12 [(103, 57), (104, 4987), (105, 53502), (106, 188830), (107, 275831), (108, 217911) n=50 107.80 hypot15 [(103, 97), (104, 4406), (105, 47363), (106, 175900), (107, 265514), (108, 223802) n=100 107.29 hypot12 [(103, 397), (104, 14872), (105, 101681), (106, 240449), (107, 264715), (108, 178790) n=100 107.33 hypot15 [(103, 615), (104, 18598), (105, 100409), (106, 228175), (107, 258464), (108, 183213) n=200 106.62 hypot12 [(102, 19), (103, 4065), (104, 55179), (105, 204706), (106, 282193), (107, 210798), (108, 119011) n=200 106.60 hypot15 [(102, 31), (103, 5541), (104, 59552), (105, 205935), (106, 278179), (107, 208483), (108, 118478) n=1000 104.68 hypot12 [(100, 102), (101, 5593), (102, 57169), (103, 184363), (104, 276279), (105, 218668), (106, 126077) n=1000 104.64 hypot15 [(100, 119), (101, 5805), (102, 60339), (103, 193004), (104, 276688), (105, 213714), (106, 122384) # Case for very large n but with fewer trials: n=10000 100.49 hypot12 [(96, 62), (97, 1261), (98, 8502), (99, 20909), (100, 25938), (101, 19875), (102, 11594) n=10000 100.48 hypot15 [(96, 61), (97, 1271), (98, 8530), (99, 20922), (100, 26032), (101, 19856), (102, 11562) n=50000 97.72 hypot12 [(93, 5), (94, 521), (95, 5593), (96, 18338), (97, 26766), (98, 22070), (99, 12926) n=50000 97.72 hypot15 [(93, 5), (94, 531), (95, 5582), (96, 18319), (97, 26805), (98, 22049), (99, 12970) https://bugs.python.org/issue41513
Open Graph Description: Improve the variable names and optimize the order that the fractional components are added together. Gives a slight improvement in speed and a minor improvement in accuracy. Baseline timing: $ pyt...
X Description: Improve the variable names and optimize the order that the fractional components are added together. Gives a slight improvement in speed and a minor improvement in accuracy. Baseline timing: $ pyt...
Opengraph URL: https://github.com/python/cpython/pull/22368
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:8496b3ac-54c4-dd6e-456d-7a801ba43241 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | BEC8:1EEB64:FD02DE:15AD98B:6969F3DA |
| html-safe-nonce | e9f0a04362c059882bcce9d1a2b39e9c1f35ff0b1406a05c4468ed82ccdcb4bc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUM4OjFFRUI2NDpGRDAyREU6MTVBRDk4Qjo2OTY5RjNEQSIsInZpc2l0b3JfaWQiOiIxNTIwNDczMTUxMDI1ODM3MDE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3fe2c90b47facd76315a0259cf2b4c7ff0ed0c6529d7d8f70dc74f2bbc31a09f |
| hovercard-subject-tag | pull_request:491295143 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/22368/checks |
| twitter:image | https://avatars.githubusercontent.com/u/1623689?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1623689?s=400&v=4 |
| og:image:alt | Improve the variable names and optimize the order that the fractional components are added together. Gives a slight improvement in speed and a minor improvement in accuracy. Baseline timing: $ pyt... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width