Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Faster parse #30

Merged
merged 1 commit into from
Aug 27, 2014
Merged

Faster parse #30

merged 1 commit into from
Aug 27, 2014

Conversation

suzaku
Copy link
Contributor

@suzaku suzaku commented Aug 27, 2014

Group all elements we want to parse in one parser so that we can parse
the thrift file in one go.

@lxyu

Group all elements we want to parse in one parser so that we can parse
the thrift file in one go.
for parse_results, _, _ in parser.scanString(schema):
for res in parse_results:
if res.getName() == 'typedefs':
result[res.getName()][res.name] = res.ttype
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的 res.getName() 直接换成 typedefs 是不是更好些?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lxyu 嗯 会快一点 你比较熟悉这个数据结构的构造 能想到什么更简洁的方式来拼出来吗?

Copy link
Contributor

Choose a reason for hiding this comment

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

不如这里直接 result[res.getName()].append(res),统一到 load 里面处理?

Copy link
Contributor

Choose a reason for hiding this comment

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

这里直接一个 comprehension 出来就行了。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lxyu load那边我还没细看,改动大吗?

Copy link
Contributor

Choose a reason for hiding this comment

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

应该不大,我来搞定好了~

lxyu added a commit that referenced this pull request Aug 27, 2014
@lxyu lxyu merged commit 9e0f178 into Thriftpy:develop Aug 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants