颤振稳定性叶瓣图_颤振性能优化

颤振稳定性叶瓣图

Ever wondered how flutter handles all your UI building and events like Futures, taps, etc.. on a single thread( yes it does all that on a single thread 😮😮😮 until and unless explicitly done).

曾经想知道flutter如何在单个线程上处理所有UI构建和事件,例如Future,taps等。(是的,它在单个线程上完成所有操作😮😮😮直到并且除非明确完成)。

什么是线程/隔离? (What is Thread/Isolates ?)

Thread is an independent process that has its own chunk of memory and executes the given instructions on that memory , It can work parallelly with other threads hence can reduce execution time of multiple process on a single thread .

线程是一个独立的进程,具有自己的内存块并在该内存上执行给定的指令。它可以与其他线程并行工作,因此可以减少单个线程上多个进程的执行时间。

Let’s understand this with an example :

让我们通过一个例子来理解这一点:

In Fps games like counter strike, Call of duty, etc. you can see that as soon as you fire a weapon few tasks executes simultaneously like playing of bullet sound, change of bullet count and reduction in opponent health , All these things happens parallelly these are basically threads which execute parallelly and execute their task on separate isolates(isolates and threads can be used interchangeably as isolate is a Dart way of multi threading more on that below) which have its own memory.

在Fps游戏中,例如反恐精英,使命召唤等,您可以看到,一旦发射武器,几乎没有同时执行的任务,例如弹奏子弹声,改变子弹数和减少对手的生命值,所有这些并行发生基本上是并行执行并在单独的隔离上执行其任务的线程(隔离和线程可以互换使用,因为隔离是Dart在下面的更多内容中介绍的多线程方法),它具有自己的内存。

Languages like JAVA and C++ Share Their heap memory with threads, but in case of flutter, every isolate has its own memory and works independently. As it has its own private space this memory doesn’t require locking, as if a thread finishes its task it already means that the thread has finished utilizing its memory space and then that memory can go for garbage collection.

诸如JAVA和C ++之类的语言与线程共享它们的内存,但是在出现混乱的情况下,每个隔离都有自己的内存并且可以独立工作。 由于该内存具有自己的私有空间,因此不需要锁定,就好像一个线程完成了它的任务一样,这意味着该线程已经完成了对它的内存空间的利用,然后该内存可以用于垃圾回收了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值