<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/rss/stylesheet/" type="text/xsl"?>
<rss xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd' xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:podbridge='http://www.podbridge.com/podbridge-ad.dtd' version='2.0'>
<channel>
  <title>苏迟但到的主页</title>
  <language>zh-cn</language>
  <generator>microfeed.org</generator>
  <itunes:type>episodic</itunes:type>
  <itunes:explicit>false</itunes:explicit>
  <atom:link rel="self" href="https://kexohproject.pages.dev/rss/" type="application/rss+xml"/>
  <link>https://kexohproject.pages.dev</link>
  <description>
    <![CDATA[<p>你好，欢迎访问个人主页！</p><p>擅长密码学，安全分析，数字水印等技术。</p><p>你可以联系我通过:findmykexin@gmail.com或者知乎私信。</p><p>我的知乎链接：<a href="https://www.zhihu.com/people/su-chi-dan-dao" rel="noopener noreferrer" target="_blank">苏迟但到 - 知乎 (zhihu.com)</a></p><p>我的github链接：<a href="https://github.com/kexinoh" rel="noopener noreferrer" target="_blank">kexinoh</a></p>]]>
  </description>
  <itunes:author>苏迟但到</itunes:author>
  <itunes:image href="https://kexohcdn.gptapi.cyou/kexohproject/production/images/channel-2e54d141ee195646ca12a9d16507a908.jpg"/>
  <image>
    <title>苏迟但到的主页</title>
    <url>https://kexohcdn.gptapi.cyou/kexohproject/production/images/channel-2e54d141ee195646ca12a9d16507a908.jpg</url>
    <link>https://kexohproject.pages.dev</link>
  </image>
  <copyright>©2024</copyright>
  <itunes:category text="Education">
    <itunes:category text="Language Learning"/>
  </itunes:category>
  <itunes:category text="Technology"/>
  <item>
    <title>一段相同的lua代码执行1百万次，在不同的地方执行它的执行时间会有70倍的差距，这是为什么？</title>
    <guid>DhB7MWbLvpa</guid>
    <pubDate>Sat, 13 May 2023 13:31:37 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<p data-pid="TQ351shD">这是由于lua的local机制导致的。</p><p data-pid="_z-M9LS5">虽然你代码没有贴出来，我都没看懂写了啥。但是99%的概率是因为lua的local机制。</p><p data-pid="Plws9LxP">local是指局部变量的意思，所以在代码中会将变量存储在寄存器中。</p><blockquote data-pid="3dEc1xVH">自Lua 5.0之后，Lua采用了一种类似于寄存器的虚拟机模式。Lua用<a href="https://link.zhihu.com/?target=http%3A//wuzhiwei.net/ds_app_stack" class=" wrap external" target="_blank" rel="nofollow noreferrer">栈</a>来储存其寄存器。每一个活动的函数，Lua都会其分配一个栈，这个栈用来储存函数里的活动记录。每一个函数的栈都可以储存至多250个寄存器，因为栈的长度是用8个比特表示的。<br/>有了这么多的寄存器，Lua的预编译器能把所有的local变量储存在其中。这就使得Lua在获取local变量时其效率十分的高。</blockquote><p data-pid="1WjM6sQJ">而全局变量会存储在内存当中，那么寄存器和内存之间的读取速度差异就是这两个速度的差异来源了。</p>]]>
    </description>
    <itunes:title>New Article Title for iTunes</itunes:title>
  </item>
</channel>
</rss>