Skip to content

API call performance #9

@paulirish

Description

@paulirish

Testing with my personal and corporate google accounts I have pretty decent latency on these drive requests.

I inspected the background page, and found the API request, "Copy as cURL" and am now running it with time and tweaking some parameters to see if i can get it faster.

On a simple query I am seeing minimum API call take 1.6s seconds, and maxing at 5.2s. Average/median is about 3ish seconds.

I tried a few things but they dont appear to be improving perf much

  1. migrating to drive API v3.
  2. corpus = default in api v2
  3. lastViewedByMeDate within the last three years

with all these applied it looks like:

function onInputChanged(text, suggest) {
    var url = 'https://www.googleapis.com/drive/v3/files';
    var date = new Date();
    date.setFullYear(date.getFullYear() - 3);
    
    var params = new URLSearchParams();
    params.append('pageSize', 5);
  
    var queries = [
      // text matches
      `fullText contains "${text}"`,
      // only google docs (docs, sheets, slides)
      `mimeType contains "google-apps"`,
      // viewed in last 3 years
      `lastViewedByMeDate > "${date.toISOString()}"`
    ];
    // text matches, and it's a google doc
    params.append('q', queries.join(' and '));
    

but like i said, the perf isn't significantly better.

The best solution is probably the same local caching approach that we ultimately did here: https://github.com/aksenol/drive-quick-search/pull/3/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions