Closed bobbingwide closed 7 years ago
The first part - load the b-letter in chunks ( 10 at a time ) - was successful so now we need to apply the solution to other areas.
The design is going to change slightly. When the user selects a second letter then the list of bigrams is displayed showing both the s-word and the b-word in each bigram; one list for both rather than one each.
S | B |
---|---|
a b c | a b c |
Scalped Brave, Scandinavian Blonde, Scenic Brittany
Additionally,
Note: On my development manchine the performance of the paginated queries to list the items with a selected s-letter or b-letter is very poor. Currently averaging over 2 seconds. How can it be sped up? All we need initially is the title and the post ID.
Action | Range | Tracing disabled | Notes |
---|---|---|---|
original code | 1.9 - 2.3 secs | 1.6-1.9 | Time for /wp/v2/bigram/s-letter=nnn&_embed=true&page=p |
Remove _embed=true |
0.5 - 0.7 secs | 0.3-0.5 | Per call |
Set per_page=20 |
0.7 | 0.4-0.5 | Per call |
Set per_page=50 |
0.9 - 1.1 secs | 0.7 - 0.8 | Per call |
Set per_page=100 |
1.4 - 1.9 | 1.1 - 1.3 | Per call |
The solution for this issue has been implemented. The code is live on http://bigram.co.uk. The Additional items below will be handled in separate issues.
The REST API works better when data is requested in chunks. But you can't set
posts_per_page
to -1 and you can't set it to an arbitrarily large number in the hope that it will be big enough.The original logic to load 31 posts_per_page for the s-letter and b-letter taxonomies doesn't work for b-letter ( see #4 ) and the logic to load s-words or b-words when an s-letter or b-letter has been selected also fails since it only loads 10 posts and that's not enough.
We need to implement the ability to load mutiple pages of results.