Lucene中string docvalues使用utf-16的优化

原来的string docvalues使用utf-8编码,载入时转码花费大量时间,我们把转码实现从new String(bytes, "UTF-8")改用lucene的bytesRef.utf8ToString,降低了大约十秒的时间。

想进一步优化,我们使用UTF-16LE编码,解码很easy甚至仅仅需拷贝,假设用简单的byte[]到char[]转换,能够在节省7秒时间,而假设用unsafe能够节省估计15秒以上的时间(没有对全量索引做測试)。

原文地址:https://www.cnblogs.com/hrhguanli/p/3829930.html