gf2121 commented on code in PR #12692: URL: https://github.com/apache/lucene/pull/12692#discussion_r1365835239
########## lucene/core/src/java/org/apache/lucene/util/fst/FST.java: ########## @@ -1081,22 +1085,30 @@ public Arc<T> findTargetArc(int labelToMatch, Arc<T> follow, Arc<T> arc, BytesRe } // Linear scan - readFirstRealTargetArc(follow.target(), arc, in); - + readFirstArcInfo(follow.target(), arc, in); + in.setPosition(arc.nextArc()); while (true) { - // System.out.println(" non-bs cycle"); - // TODO: we should fix this code to not have to create - // object for the output of every arc we scan... only - // for the matching arc, if found - if (arc.label() == labelToMatch) { - // System.out.println(" found!"); - return arc; - } else if (arc.label() > labelToMatch) { + assert arc.bytesPerArc() == 0; + flags = arc.flags = in.readByte(); + long pos = in.getPosition(); + int label = readLabel(in); + if (label == labelToMatch) { + in.setPosition(pos); + return readArc(arc, in); + } else if (label > labelToMatch) { return null; } else if (arc.isLast()) { return null; } else { - readNextRealArc(arc, in); + if (flag(flags, BIT_ARC_HAS_OUTPUT)) { + outputs.skipOutput(in); + } + if (flag(flags, BIT_ARC_HAS_FINAL_OUTPUT)) { Review Comment: @mikemccand Thank you for the explanation ! I'll merge/backport this soon. BTW, We are suffering a performance [regression](https://home.apache.org/~mikemccand/lucenebench/2023.10.10.18.03.55.html) for PkLookup task after using [MSB VLong output](https://github.com/apache/lucene/pull/12631) in block tree index. We need to either get the speed back or reevaluate the trade off between space and performance on MSB VLong output. I raised https://github.com/apache/lucene/pull/12699 to try to get speed back, looking forward to getting your opinion on this patch. Would you please take a look when you have some time? Thank you! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org