[JAVA-983] Java driver (and other drivers too) create new java String instances each time a field CStr is encountered Created: 29/Sep/13  Updated: 07/Mar/14  Resolved: 07/Mar/14

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: 2.9.3
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Mark Ponthier Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Java


Backwards Compatibility: Fully Compatible

 Description   

New java String instances are created for each field CStr encountered. This enhancement would construct field CStr instances only once and return the previously constructed instance on subsequent invocations. My early performance analysis indicates a decoding performance improvement of 7% while also reducing memory consumption and as a result also enhances performance via reduced garbage collection.



 Comments   
Comment by Mark Ponthier [ 05/Mar/14 ]

Please close. This is an old ticket.

Comment by Jeffrey Yemin [ 29/Sep/13 ]

Hi, you can get instructions here: https://help.github.com/articles/using-pull-requests.

Is the idea to use String.intern? If so, please read http://java-performance.info/string-intern-in-java-6-7-8/, particularly since the driver needs to support Java 5 and up.

Comment by Mark Ponthier [ 29/Sep/13 ]

I need to get a driver pull request in order to address this enhancement, but as of now, I'm not quite sure how to do that. An email I received earlier indicated that this could be done as part of the issue submission process. Please advise how to proceed.

Generated at Thu Feb 08 08:53:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.