GithubHelp home page GithubHelp logo

请问doRead方法不会阻塞主线程,内部是使用多线程读取excel行的还是就一个独立于主线程的子线程在从上到下读取excel? about easyexcel HOT 13 CLOSED

0x141026 avatar 0x141026 commented on June 10, 2024
请问doRead方法不会阻塞主线程,内部是使用多线程读取excel行的还是就一个独立于主线程的子线程在从上到下读取excel?

from easyexcel.

Comments (13)

gongxuanzhang avatar gongxuanzhang commented on June 10, 2024 1

都会阻塞, doReadSync只是有返回值

from easyexcel.

gongxuanzhang avatar gongxuanzhang commented on June 10, 2024

会阻塞的

from easyexcel.

0x141026 avatar 0x141026 commented on June 10, 2024

会阻塞的

doReadSync方法才会阻塞主线程吧?

from easyexcel.

0x141026 avatar 0x141026 commented on June 10, 2024

都会阻塞, doReadSync只是有返回值

哦哦,我一会试验一下。还有一个问题,不能并发读取多行吗?还是只能从上到下依次顺序读取?

from easyexcel.

gongxuanzhang avatar gongxuanzhang commented on June 10, 2024

哦哦,我一会试验一下。还有一个问题,不能并发读取多行吗?还是只能从上到下依次顺序读取?

只能从上到下,如果你想多线程你可以在监听器里面执行,但是建议自己加一个buffer来处理,并发安全也要自己解决

from easyexcel.

0x141026 avatar 0x141026 commented on June 10, 2024

哦哦,我一会试验一下。还有一个问题,不能并发读取多行吗?还是只能从上到下依次顺序读取?

只能从上到下,如果你想多线程你可以在监听器里面执行,但是建议自己加一个buffer来处理,并发安全也要自己解决

我问的是自带的doRead本身会不会并发读取?而且监听器里也没法实现并发读取excel的不同行吧,你重写哪个能实现并发读取?

from easyexcel.

gongxuanzhang avatar gongxuanzhang commented on June 10, 2024

我问的是自带的doRead本身会不会并发读取?而且监听器里也没法实现并发读取excel的不同行吧,你重写哪个能实现并发读取?

不是说了不会并发吗,会阻塞.
如果你一定要并发你就自己写逻辑,但是不建议

from easyexcel.

0x141026 avatar 0x141026 commented on June 10, 2024

我问的是自带的doRead本身会不会并发读取?而且监听器里也没法实现并发读取excel的不同行吧,你重写哪个能实现并发读取?

不是说了不会并发吗,会阻塞.

如果你一定要并发你就自己写逻辑,但是不建议

怎么写,能给个思路吗,比如我要的是并发读取100行,一个线程读前50,后一个读后50行。

from easyexcel.

gongxuanzhang avatar gongxuanzhang commented on June 10, 2024

怎么写,能给个思路吗,比如我要的是并发读取100行,一个线程读前50,后一个读后50行。
做不到并发读,但是你可以并发处理读取出来的数据

from easyexcel.

0x141026 avatar 0x141026 commented on June 10, 2024

怎么写,能给个思路吗,比如我要的是并发读取100行,一个线程读前50,后一个读后50行。

做不到并发读,但是你可以并发处理读取出来的数据

这我明白。是我提问的方式有问题吗……,问的就是能不能并发读?能或者不能😆就完事了。还是谢谢你的帮助🙏

from easyexcel.

gongxuanzhang avatar gongxuanzhang commented on June 10, 2024

这我明白。是我提问的方式有问题吗……,问的就是能不能并发读?能或者不能😆就完事了。还是谢谢你的帮助🙏

第一个问题:不能并发读.
你的目的不是提高性能吗.
所以我的意思是给你一个思路,如果需要提升性能,可以在处理数据的时候开启多线程, 不需要一个线程既读取数据又处理数据,当然这要看你自己的业务是否允许.
顺便需要提醒的是如果按这种思路来优化,最好自己加一个buffer(阻塞队列也可以)用来存储读取的内容

from easyexcel.

0x141026 avatar 0x141026 commented on June 10, 2024

这我明白。是我提问的方式有问题吗……,问的就是能不能并发读?能或者不能😆就完事了。还是谢谢你的帮助🙏

第一个问题:不能并发读.

你的目的不是提高性能吗.

所以我的意思是给你一个思路,如果需要提升性能,可以在处理数据的时候开启多线程, 不需要一个线程既读取数据又处理数据,当然这要看你自己的业务是否允许.

顺便需要提醒的是如果按这种思路来优化,最好自己加一个buffer(阻塞队列也可以)用来存储读取的内容

读完之后并发处理我知道。那就是没法提升读取的速度咯?如果有上万行也是顺序读下来。

from easyexcel.

gongxuanzhang avatar gongxuanzhang commented on June 10, 2024

读完之后并发处理我知道。那就是没法提升读取的速度咯?如果有上万行也是顺序读下来。

是的,读取只能解决大量占用内存的问题 不能提升速度

from easyexcel.

Related Issues (20)

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.