[SERVER-42130] optimization opportunity in ItoA Created: 09/Jul/19 Updated: 29/Oct/23 Resolved: 29/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | 4.3 Desired |
| Fix Version/s: | 4.3.1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Sprint: | Dev Tools 2019-07-15, Dev Tools 2019-07-29 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||
| Comments |
| Comment by Githook User [ 12/Nov/19 ] |
|
Author: {'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}Message: |
| Comment by Githook User [ 12/Nov/19 ] |
|
Author: {'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}Message: |
| Comment by Billy Donahue [ 29/Jul/19 ] |
|
https://github.com/mongodb/mongo/commit/dae371c478e1a828ac911096d85f94be8e936ef9
|
| Comment by Billy Donahue [ 22/Jul/19 ] |
|
The last comment about DecimalCounter didn't pan out, btw. The DecimalCounter is still faster than ItoA. I wonder if the two things should be combined though. They both have an onboard buffer to hold digits, and they manage a concept of being representations of int. ItoA has the ability to be set to any value, and DecimalCounter adds the ability to be incremented. Seems they could easily live in the same class. But later. |
| Comment by Billy Donahue [ 11/Jul/19 ] |
|
This optimization to ItoA could become a significant optimization to DecimalCounter. ItoA can produce all the strings from 0 to 9999 much faster than DecimalCounter can, because it just looks them up in a table (which takes ~3.5 nsec). At some point beyond 10000, I suppose DecimalCounter's increment algorithm would start to win. DecimalCounter is primarily used to produce decimal ramp functions for array BSONification. DecimalCounter could just call ItoA for the answer until its counter reaches 10000. Most runs of DecimalCounter are not going to get that long.
|
| Comment by Billy Donahue [ 09/Jul/19 ] |