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

Speed up WSDL parsing #1218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Speed up WSDL parsing #1218

wants to merge 1 commit into from

Conversation

tomquist
Copy link

@tomquist tomquist commented May 4, 2023

We were running into performance issues while generating a SOAP client. I profiled the client generation and identified two bottlenecks in parsing WSDL files:

  • When visiting an unexpected node an error got constructed that was discarded later on in non-strict mode. Constructing an error is pretty expensive because Node needs to capture the stack.
  • splitQName split the entire nsName string even though it's only interested in the first element

We were running into performance issues while generating a SOAP client.
I profiled the client generation and identified two bottlenecks in parsing WSDL files:
- When visiting an unexpected node an error got constructed that was discarded later on in non-strict mode. Constructing an error is pretty expensive because Node needs to capture the stack.
- splitQName split the entire nsName string even though it's only interested in the first element
assert.ok(client.lastElapsedTime);
assert.ok(client.lastElapsedTime !== undefined);
Copy link
Author

Choose a reason for hiding this comment

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

This seems to be flaky on my machine because it's 0 sometimes (and more likely with this change), which is falsy. However, we're only interested in the existence of the value.

Comment on lines +189 to +193
public startElement(stack: Element[], nsName: string, attrs, options: IWsdlBaseOptions, schemaXmlns) {
const child = new UnexpectedElement(nsName, attrs, options, schemaXmlns);
child.init();
stack.push(child);
}
Copy link
Author

Choose a reason for hiding this comment

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

This short-circuits the allowedChildren lookup.

@w666
Copy link
Collaborator

w666 commented Apr 26, 2024

Changes look good. I guess you run some performance tests, how much faster parsing now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants