-
Notifications
You must be signed in to change notification settings - Fork 278
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
[PORT] Further improve LG's performance #2409
Conversation
Pull Request Test Coverage Report for Build 142017
💛 - Coveralls |
@@ -268,20 +270,32 @@ export class Templates implements Iterable<Template> { | |||
*/ | |||
public updateTemplate(templateName: string, newTemplateName: string, parameters: string[], templateBody: string): Templates { | |||
const template: Template = this.items.find((u: Template): boolean => u.name === templateName); | |||
if (template === undefined) { | |||
return this; | |||
if (template !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
template !== undefined [](start = 12, length = 22)
Would if (template) make sense or do you need to do the next steps even if template is an empty string? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Solved #Resolved
|
||
private adjustRangeForUpdateTemplate(oldTemplate: Template, newTemplate: Template): void { | ||
const lineOffset = newTemplate.sourceRange.range.end.line - newTemplate.sourceRange.range.start.line | ||
- (oldTemplate.sourceRange.range.end.line - oldTemplate.sourceRange.range.start.line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be clearer if you did a const newRange = newTemplate.sourceRange.range and const oldRange = oldTemplate.soureceRange first and rewrote that in terms of this. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Solved #Resolved
@@ -175,6 +175,22 @@ export class TemplatesParser { | |||
return templates; | |||
} | |||
|
|||
public static antlrParseTemplates(text: string, source: string): FileContext { | |||
if (!text || text.trim() === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation of public element. This needs to be public? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Solved #Resolved
} | ||
|
||
|
||
class TemplatesTransformer extends AbstractParseTreeVisitor<any> implements LGTemplateParserVisitor<any> { | ||
export class TemplatesTransformer extends AbstractParseTreeVisitor<any> implements LGTemplateParserVisitor<any> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export [](start = 0, length = 6)
If exporting you should have documentation. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Solved #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
@@ -175,6 +175,28 @@ export class TemplatesParser { | |||
return templates; | |||
} | |||
|
|||
/** | |||
* Parse LG content and achieve the AST. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
achieve [](start = 28, length = 7)
return
|
||
class TemplatesTransformer extends AbstractParseTreeVisitor<any> implements LGTemplateParserVisitor<any> { | ||
/** | ||
* Templates transfeormer. Fullfill more details and body context into the templates object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transfeormer [](start = 13, length = 12)
transformer
|
||
class TemplatesTransformer extends AbstractParseTreeVisitor<any> implements LGTemplateParserVisitor<any> { | ||
/** | ||
* Templates transfeormer. Fullfill more details and body context into the templates object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fullfill [](start = 27, length = 8)
Add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix two minor typos and good to go. |
issue link: microsoft/botbuilder-dotnet#4156
Fixes #2441
Two operations to improve LG's performance
Results comparison table: