[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: Text File notes.txt     Text File patch_set_3.txt    
Issue Links:
Depends
Problem/Incident
Related
related to SERVER-42362 SockAddr looks beyond StringData length Closed
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: SERVER-42130 fix: workaround MSVC constexpr problem
Branch: master
https://github.com/mongodb/mongo/commit/812524322f9f947ca2198366f9802b8befe3274d

Comment by Githook User [ 12/Nov/19 ]

Author:

{'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}

Message: SERVER-42130 Replace python codegen with macros
Branch: master
https://github.com/mongodb/mongo/commit/5d66062d86982873174e70415279ce0821ba5bbd

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 ]

https://mongodbcr.appspot.com/503850001/

Generated at Thu Feb 08 04:59:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.