We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
抽象语法树名称规范化:
抽象语法树解析性能优化:
amt_node
TokenScanner
FSMMachine.handle()
FSMOperate
execute
FSMOperate.type
FSMOperate.execute()
FSM_OPERATION_MAP
FSMMachine.parse
SQLParser
TokenScanner.search()
pop()
move()
AMTParenthesisBase.equals()
AMTNode
__slots__
search
serach_and_move
FSMStatus
IntEnum
split_by
get
pop
FSMMemory
match
search_and_move
is None
CASE
@property
source
children
cache_reset_and_handle
enumerate
FSMMachine
其他优化:
get_as_source
get_as_source_or_null
性能测试集(修改前):35.10s、31.85s、32.90s、31.75s、32.22s 性能测试集(修改后):7.35s、7.44s、7.44s、7.41s、7.31s
The text was updated successfully, but these errors were encountered:
ChangxingJiang
Successfully merging a pull request may close this issue.
抽象语法树名称规范化:
抽象语法树解析性能优化:
amt_node
直接使用字符串标记进行判断的功能TokenScanner
中的使用 @Property 方法改为直接使用私有属性FSMMachine.handle()
中的逻辑拆分到每个FSMOperate
的execute
方法中,从而在解析中需要通过判断FSMOperate.type
来确定处理方法FSMOperate.execute()
方法的状态操作,避免无效的状态更新FSM_OPERATION_MAP
的双层字典改为单层字典FSMMachine.parse
中遍历下标再用下标获取字符,改为直接遍历字符串SQLParser
中各个解析方法增加不兼容字符串的私有方法,并在相互间调用时使用该私有方法TokenScanner.search()
优先判断匹配是否超出扫描器长度,从而仅执行一次扫描器长度的检查TokenScanner
的pop()
方法拆分为pop()
和不返回值仅移动指针的move()
方法AMTParenthesisBase.equals()
方法,使其不需要比较源代码AMTNode
节点的__slots__
属性search
和serach_and_move
改为专有解析逻辑FSMStatus
的枚举值改为小整数,并将枚举类改为IntEnum
以避免哈希值计算FSM_OPERATION_MAP
的默认值单独拆分为一个字典,从而使第二次查询由计算元组哈希值变为直接使用整数作为哈希值TokenScanner
的split_by
方法,避免多次遍历相同元素TokenScanner
的get
和pop
方法,移除对数组下标超界的额外判断,改为直接抛出数组超界的异常FSMMemory
逻辑,不再将遍历的字符串放到列表中缓存,而是在构成词语后再从原始字符串中切片match
失败异常原因TokenScanner
的search
和search_and_move
中无意义的is None
判断CASE
的语句按出现频率从高到低排序AMTNode
节点的@property
属性source
和children
改为实例的__slots__
属性FSMMemory
的cache_reset_and_handle
方法逻辑移动到FSMOperate
的execute
方法中TokenScanner
的search
方法和search_and_move
方法拆分出各种不需要类型判断的特有匹配方法FSMMemory
中维护当前下标,重新将FSMMachine.parse
中改为字符串遍历而非enumerate
FSMMachine
对于不移动指针执行规则的处理逻辑其他优化:
TokenScanner
的get_as_source
方法改为get_as_source_or_null
方法性能测试集(修改前):35.10s、31.85s、32.90s、31.75s、32.22s
性能测试集(修改后):7.35s、7.44s、7.44s、7.41s、7.31s
The text was updated successfully, but these errors were encountered: