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

lexer重构,改为状态tag驱动的经典状态机 #33

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

lexer重构,改为状态tag驱动的经典状态机 #33

wants to merge 4 commits into from

Conversation

QuarkGluonPlasma
Copy link
Contributor

@QuarkGluonPlasma QuarkGluonPlasma commented Mar 16, 2021

lexer重构,加上了状态的tag,通过tag驱动流转,把tag部分拆分成了3个状态。

本来是为了提升可读性,结果意外的提升了性能,15%左右。

加入了context,之前叫state。在状态流转的过程中传递context

@QuarkGluonPlasma QuarkGluonPlasma changed the title lexer重构,改为状态tag驱动的经典状态及 lexer重构,改为状态tag驱动的经典状态机 Mar 16, 2021
@yisar
Copy link
Contributor

yisar commented Mar 16, 2021

看上去似乎也看不出哪里性能有差距
我怀疑我写的哪里有可能比较慢,明天研究下

NEXT: Symbol()
}

const stateHandlerMap = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Map直接接受这个二维数据就好了

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

Successfully merging this pull request may close these issues.

3 participants