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

三级联动数据量非常大时,内存受得了吗? #22

Closed
anthonyY opened this issue Aug 24, 2018 · 2 comments
Closed

三级联动数据量非常大时,内存受得了吗? #22

anthonyY opened this issue Aug 24, 2018 · 2 comments

Comments

@anthonyY
Copy link

我看你这里设计成了把所有数据都放在 map<String, List>这种方式,会非常耗内存,而我们的省市区数据库数据量非常庞大,如果做成这种方式,感觉是不合适的,请问作者有什么想法?

@imkarl
Copy link
Owner

imkarl commented Aug 24, 2018

内存占用应该不是问题,主要是读取数据+处理成map形式 这个环节消耗资源。

假设中国有50个省,每个省50个市,每个市有50个县,每个地名有5个汉字:
因为一个汉字占用2个字节,所占用的内存应该是 50505025(字节)。也就是 1.2兆字节 左右
和一张600*600的图片占用的内存差不多

@imkarl
Copy link
Owner

imkarl commented Aug 24, 2018

如果想做一下优化,那就改成按需加载,不要一次性读取全部数据了。

@imkarl imkarl closed this as completed Mar 20, 2019
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

2 participants