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

Performance improvements #4

Merged
merged 2 commits into from
Jun 2, 2017
Merged

Performance improvements #4

merged 2 commits into from
Jun 2, 2017

Conversation

matt-allan
Copy link

@matt-allan matt-allan commented Jun 2, 2017

I ran some tests with blackfire because dereferencing the swagger schema seemed slow. Apparently the JSON Schema scope resolver is the bottleneck.

To resolve the Swagger schema we have to call Pointer::get 1104 times. First I optimized the pointer, but then I realized we can cut the pointer usage out of that function completely.

259 ms → 65.6 ms

Wall Time    65.6ms  -193ms +151.4%
CPU  Time       n/a             n/a
I/O  Time       n/a             n/a
Memory        1.1MB   -432B     n/s
Network         n/a     n/a     n/a
SQL             n/a     n/a

@matt-allan matt-allan force-pushed the perf-hacks branch 4 times, most recently from 990126a to df19a12 Compare June 2, 2017 17:26
Matt Allan added 2 commits June 2, 2017 10:28
- Prevent internal try/catch when pointers reference non-existent values.
- Remove unnecessary strpos, array_map, and str_replace calls when
parsing pointers.
- Resolve JSON Schema scope without using pointers at all.
- Replace recursion and array_shift with foreach when traversing
pointers.
@matt-allan matt-allan changed the title [WIP Performance improvements Performance improvements Jun 2, 2017
@matt-allan matt-allan merged commit ed9627b into master Jun 2, 2017
@matt-allan matt-allan deleted the perf-hacks branch June 2, 2017 17:43
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

1 participant