[
https://issues.apache.org/jira/browse/IOTDB-164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17119358#comment-17119358
]
Xiangdong Huang commented on IOTDB-164:
---------------------------------------
I modified the experiment codes and get the similar result:
Benchmark Mode Cnt Score Error Units
Test.getTestLong avgt 10 8203.954 ± 1444.850 ns/op
Test.getTestLongNull avgt 10 10038.586 ± 2320.039 ns/op
Test.getTestString avgt 10 7911.632 ± 1622.934 ns/op
Test.getTestStringNull avgt 10 21061.163 ± 42762.196 ns/op
Test.putTestLong avgt 10 7747.544 ± 1235.524 ns/op
Test.putTestLongExisting avgt 10 8507.581 ± 2145.228 ns/op
Test.putTestString avgt 10 7668.483 ± 1265.896 ns/op
Test.putTestStringExisting avgt 10 9005.981 ± 1570.452 ns/op
The only concern is, if we use operations like String + String, or long to Long,
the performance will degradation hugely.
Besides, String + String spends more time than long to Long.
Conclusion, replacing the hashmap key from String to Long has no benefit...
But we have to avoid operating a String in our program. (Long can help us avoid
that but it brings another pitfall: input a long and then let Java convert it
to Long.)[^Test.java]
> Convert Path(String) to ID(Long)
> --------------------------------
>
> Key: IOTDB-164
> URL: https://issues.apache.org/jira/browse/IOTDB-164
> Project: Apache IoTDB
> Issue Type: Improvement
> Reporter: Yanzhe An
> Priority: Major
> Labels: medium
> Attachments: Test.java, path.png, tmp.java
>
>
> Now in IoTDB, paths of time series are in the form of *String*. The path of
> a time series contains the information of its storage group, device, and
> measurement.
> !path.png!
> However, the fact shows that there may be overlaps between paths. For
> example, time series belonging to the same storage group _sg123_ must be
> prefixed with the name of _sg123_. It can cause the problem of wasted space.
> By contrast, *Long* takes much less space than *String*.
> What's worse, paths are usually put into the *Map* structure to carry out
> other operations. It can cause the problem of wasted time. By contrast, when
> carrying out operations of _put_, _get_, and _remove,_ *Map<Long, Integer>*
> performs better than *Map<String, Integer>*.
> Therefore in IoTDB, paths in the form of *String* should be replaced by IDs
> in the form of *Long*.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)