Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

插入数据,获取数据很慢 #122

Open
fengyu999 opened this issue May 28, 2020 · 3 comments
Open

插入数据,获取数据很慢 #122

fengyu999 opened this issue May 28, 2020 · 3 comments

Comments

@fengyu999
Copy link

插入数据,获取数据很慢,一个700条数据需要2-3秒,请问下这个可能是什么问题,其他人使用也是这么慢吗?

@cityleaf
Copy link

cityleaf commented Sep 3, 2020

插入数据,获取数据很慢,一个700条数据需要2-3秒,请问下这个可能是什么问题,其他人使用也是这么慢吗?

今天遇到,查询表的1000条数据,花了2000ms,已经解决,将时间降低到40多ms。
先说说慢的问题,并不是因为FMDB读取数据慢,而是模型转换慢
BGTool.m

  • (void)tansformDataFromSqlDataWithTableName:(NSString *)tableName class:(__unsafe_unretained Class)cla array:(NSArray *)array
    这个方法负责模型转换,可以打印时间验证
    1、不必要的字段和数据尽量不要存储,优化存储字段,减少数据量
    2、重写这一个方法,GCD多线程转换
    3、YYModel

image

@fengyu999
Copy link
Author

已转Realm数据库

@Bogon
Copy link

Bogon commented Aug 23, 2021

这个框架最耗时的地方是每条记录都会更新updatetime(框架自己搞的)时间,插入搞了一个inserttime,时间和字符串互转很是耗时。放弃吧,换其他的吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants