[OPNFLWPLUG-372] Replace all String.split() with guava's Splitter Created: 27/Feb/15  Updated: 27/Sep/21  Resolved: 15/Aug/17

Status: Resolved
Project: OpenFlowPlugin
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Michal Rehak Assignee: Shuva Jyoti Kar
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All



 Description   

String.split is slow and broken (https://code.google.com/p/guava-libraries/wiki/StringsExplained#Splitter). Guava provides reusable (= faster) and configurable (= not broken, works as configured) implementation.



 Comments   
Comment by Timotej Kubas [ 09/Mar/15 ]

https://git.opendaylight.org/gerrit/#/c/16179/
https://git.opendaylight.org/gerrit/#/c/16180/
https://git.opendaylight.org/gerrit/#/c/16181/
https://git.opendaylight.org/gerrit/#/c/16183/

Comment by Abhijit Kumbhare [ 10/Nov/15 ]

Michal,

Any thoughts on this?

Thanks,
Abhijit

Comment by Michal Rehak [ 10/Nov/15 ]

This is technical depth and does not affect exposed API. As soon as we have settled API-freeze related changes I can finish this.

Comment by Shuva Jyoti Kar [ 28/May/16 ]

Given that Guava's Splitter doesn't incur the overhead of regular expressions when you don't ask for it, and is very fast as a general rule and it is much more predictable than String.split(), this is indeed a nice enhancement.

Comment by Andrej Leitner [ 17/Aug/16 ]

Patches were not merged and need to be rewritten, cancelling WFR status for now.

Comment by Shuva Jyoti Kar [ 17/Aug/16 ]

Some of the patches were merged:

https://git.opendaylight.org/gerrit/#/q/project:openflowplugin+message:2771+status:merged

Comment by Jozef Bacigal [ 02/Jun/17 ]

Guava splitter is quicker just only the results it gives back. It is not creating a new string objects. So in long string maybe it will be quicker, but with short string with two or just few substrings it will be slower even when we create a new strings object anyway.

So this enhancement is no needed anyway.

Closing

Comment by Vratko Polak [ 15/Aug/17 ]

> in long string maybe it will be quicker,
> but with short string with two or just few substrings it will be slower

Can we measure that?
And by the way, the correct status seems to be WORKSFORME.

Generated at Wed Feb 07 20:32:17 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.