Openresty Principles and Concepts (11) Why should you avoid using NYI?

 JIT Compiler Achilles’ Heel: Why Avoid NYI?

①Problem    introduction

1) 那么到底有'哪些操作'可以被 JIT,哪些不能呢?

2) 怎样才可以'避免'写出'不能'被 JIT 的代码呢?

②Review  of the previous section

③What   is NYI?

NYI function

Complete list of NYI 

④  string library function in NYI list

说明:本文以'较多的篇幅'来谈及 OpenResty 的'性能'问题 --> '关于 NYI 的优化'

 ⑤   Alternatives to NYI

1) '大部分' NYI 函数我们都可以'敬而远之',通过'other其他方式'来实现它们的功能

2) 接下来'挑选'了'4'个'典型的 NYI' 来讲解,来了解不同类型的 NYI '替代'方案

3) 这样'其他的 NYI' 你也可以自己'触类旁通'

Lua-nginx-module's github documentation page     nginx source code analysis auto/lib script

1) PCRE 从 '8.20' 版本开始,提供了JIT,可使用'--enable-jit'参数构建

2) 可通过 '--with-pcre-jit' 配置参数启用 JIT 支持

备注: PCRE JIT 可以显式'加快正则表达式'的处理速度

3) http { pcre_jit on; }

思考: 如何'封装'字符串查找函数?

备注: Accroding from the 'new NYI list', the paris have been implement

⑥How  to detect NYI?

1) 方式'一'

2) 方式'二'

 [1]、这个方法相对比较'繁琐'

 [2]、如果你想要'简单验证'的话,使用 'resty' 就足够了

 [3]、这个 OpenResty 的 CLI 带有'相关选项': -j

案例:而如果遇到 'NYI 原语',输出里面就会'指明 NYI',以这个 'pairs' 未为例

⑦  Answer questions and solve doubts

1) '<<lua程序设计>>' lua'入门'必备

2) '<<lua设计与实现>>' 深入'解释器虚拟机'的原理

  

⑧   luajit API

link 1    link 2   link 3

Guess you like

Origin blog.csdn.net/wzj_110/article/details/131350090