Task #12385 (new)
Opened 10 years ago
Last modified 8 years ago
Unnecessary thread safety from Vector?
Reported by: | mtbcarroll | Owned by: | mtbcarroll |
---|---|---|---|
Priority: | minor | Milestone: | Unscheduled |
Component: | Bio-Formats | Version: | 5.0.2 |
Keywords: | improvement | Cc: | bf@… |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | n.a. |
Sprint: | n.a. |
Description
Bio-Formats uses Vector in plenty of places where I wonder if we don't need the synchronization overhead. Perhaps ignoring components like bio-formats-plugins and forks, I'd be happy to open PRs to try changing the code in autogen and the readers and suchlike to use ArrayList if that's judged desirable. Will await comment before actually going for it.
Change History (9)
comment:1 Changed 10 years ago by mtbcarroll
comment:2 Changed 10 years ago by mlinkert
I think it's fine to do this for internal usage of Vector, but maybe not in places where it will change public API unless there is a very good reason.
comment:3 Changed 10 years ago by mtbcarroll
Hashtable may also be a target.
comment:4 Changed 10 years ago by mtbcarroll
Hashtable turns out not to be much of a viable target: it is too much part of the metadata API to be changed at the moment.
comment:5 Changed 10 years ago by jamoore
Hmmmm....would be interesting to scope what all will break. Uses in scripting languages may just keep working (MATLAB, IJ macros, etc)
comment:6 Changed 10 years ago by crueden-x
If backwards compatibility is an issue, why not deprecate the old API and add new methods with the more modern Collections API types?
comment:7 Changed 10 years ago by jburel
- Keywords improvement added
comment:8 Changed 9 years ago by mtbcarroll
crueden-x: Good idea. I wonder when would be the best time to do so.
Note: In replacing Stack with Deque, note that this reverses the collection's natural iteration order.
To avoid breaking external code, I do not know if things like services' getAttributeList(), getDocumentList(), getVariableList() would have to keep returning Vector<String> instead of List<String>.