GithubHelp home page GithubHelp logo

Comments (3)

handsomezhou avatar handsomezhou commented on August 22, 2024

1.加载数据;
2.解析数据
3.匹配数据
其中1,2整个过程基本只执行一次;随后数据保存在内存中,
搜索动作只执行3操作.基本上是很快的.
如果是搜索的时候耗时要800多毫秒,肯定是哪里有些问题.
我demo中的搜索方法,数据达到3000多条时,也都比较快.

你可以对比一下ContactsSearch.apk的执行效率.

PS:ContactsSearch.apk运行后如果没有数据,请记得给其读取联系人权限.

from pinyinsearchlibrary.

Hhh3S avatar Hhh3S commented on August 22, 2024

Thank You,我重新分析了一下问题,我数据库中的数据是加密的,把数据从数据库中拉出来到完全完成解密,耗费大概300ms左右,然后在内存中完成拼音解析并匹配又耗时300ms左右,我在想能否直接把拼音存到数据库中,直接用sql去匹配不知道是否可行,我还没想好怎么存储。再次感谢!

from pinyinsearchlibrary.

handsomezhou avatar handsomezhou commented on August 22, 2024

如果数据量在万条以内,可以加载完数据,解密,再解析数据,让它一直在内存中,只有第一次的时候会慢一点.
每次去搜索的时候,不要再进行上述步骤,直接匹配数据就可以了.
如果有数据增加或者删除,再重新走一遍上述流程.

不建议直接把拼音存数据库,sql去匹配达不到理想的效果.
如果每次解密嫌比较慢,数据又不敏感的话,倒是建议在数据库中存复制一份明文的数据,然后直接加载这份明文的数据.PS:这种情况注意密文与明文数据同步就可以了.

from pinyinsearchlibrary.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.