I did a little more based on your idea, could you give it a try? https://hibernate.onjira.com/browse/HHH-7869 https://github.com/hibernate/hibernate-orm/pull/426
I also have the test result attached to the jira On Dec 17, 2012, at 12:47 PM, Strong Liu <st...@hibernate.org> wrote: > Stepan, > > thanks for the patch, though there are some processes we'd like to use: > > 1. open a jira ( since HHH-766 is closed ) and link it to the original one > (HHH-766) > 2. give some numbers / tests to show your patch performs better than the old > one > 3. create a github pull request > > > p.s. from what i found, > org.hibernate.internal.util.StringHelper#firstIndexOfChar is only used to > search org.hibernate.hql.internal.classic.ParserHelper#HQL_SEPARATORS > > so, maybe we should build a static set for it to avoid build the set every > time. > > On Dec 16, 2012, at 4:52 PM, Stepan Yakovenko <stiv.yakove...@mail.ru> wrote: > >> HI! >> >> StringHelper.firstIndexOfChar is extremely inefficient on long strings. It'd >> scan all string many times even if it starts with stop character. I propose >> to change it this way: >> >> public static int firstIndexOfChar(String sqlString, String string, int >> startindex) { >> Set stopchars = new HashSet(); >> for (int i = 0; i < string.length(); i++) >> stopchars.add(string.charAt(i)); >> for (int i = startindex; i < sqlString.length(); i++) { >> if (stopchars.contains(sqlString.charAt(i))) >> return i; >> } >> return -1; >> } >> works fine in my project. >> >> >> Stepan Yakovenko, stiv.yakove...@mail.ru, +79039036253 >> _______________________________________________ >> hibernate-dev mailing list >> hibernate-dev@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/hibernate-dev > > ------------------------- > Best Regards, > > Strong Liu <stliu at hibernate.org> > http://about.me/stliu/bio > ------------------------- Best Regards, Strong Liu <stliu at hibernate.org> http://about.me/stliu/bio _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev