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

Optimize bloom filter application #6992

Merged
merged 15 commits into from
Feb 9, 2023

Conversation

milaGGL
Copy link
Contributor

@milaGGL milaGGL commented Jan 31, 2023

clean code optimization:

  • Validate base64 string in decodeBase64 .

  • normalizeByteString calls decodeBase64 from '../platform/base64', where we decide which decode function should be used based on the platform(node, browser, rm).

  • Do the validation here while calling decode function.

  • Serialize document ResourcePath into a full document path string.

  • To get the full path, we need databaseId.

  • Add getDatabaseId to the WatchChangeAggregator.metadataProvider

  • Add canonical string function to DatabaseId.

@changeset-bot
Copy link

changeset-bot bot commented Jan 31, 2023

⚠️ No Changeset found

Latest commit: 7f5cfe7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@milaGGL milaGGL changed the base branch from master to mila/BloomFilter January 31, 2023 00:09
@milaGGL milaGGL self-assigned this Jan 31, 2023
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 31, 2023

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (c128eaa)Merge (9005380)Diff
    browser276 kB277 kB+986 B (+0.4%)
    esm5343 kB344 kB+1.04 kB (+0.3%)
    main551 kB551 kB+186 B (+0.0%)
    module276 kB277 kB+986 B (+0.4%)
    react-native276 kB277 kB+1.00 kB (+0.4%)
  • @firebase/firestore-lite

    TypeBase (c128eaa)Merge (9005380)Diff
    browser86.2 kB86.6 kB+394 B (+0.5%)
    esm5104 kB105 kB+430 B (+0.4%)
    main147 kB147 kB-44 B (-0.0%)
    module86.2 kB86.6 kB+394 B (+0.5%)
    react-native86.4 kB86.8 kB+411 B (+0.5%)
  • @firebase/util

    TypeBase (c128eaa)Merge (9005380)Diff
    browser22.9 kB23.1 kB+159 B (+0.7%)
    esm524.4 kB24.7 kB+315 B (+1.3%)
    main30.0 kB30.4 kB+443 B (+1.5%)
    module22.9 kB23.1 kB+159 B (+0.7%)
  • bundle

    43 size changes

    TypeBase (c128eaa)Merge (9005380)Diff
    analytics (logEvent)43.0 kB43.1 kB+93 B (+0.2%)
    app-check (CustomProvider)36.1 kB36.2 kB+93 B (+0.3%)
    app-check (ReCaptchaEnterpriseProvider)38.4 kB38.5 kB+95 B (+0.2%)
    app-check (ReCaptchaV3Provider)38.4 kB38.5 kB+95 B (+0.2%)
    auth (Anonymous)67.4 kB67.5 kB+95 B (+0.1%)
    auth (EmailAndPassword)71.5 kB71.6 kB+95 B (+0.1%)
    auth (GoogleFBTwitterGitHubPopup)93.9 kB94.0 kB+94 B (+0.1%)
    auth (GooglePopup)91.1 kB91.2 kB+95 B (+0.1%)
    auth (GoogleRedirect)91.4 kB91.5 kB+95 B (+0.1%)
    auth (Phone)77.6 kB77.7 kB+95 B (+0.1%)
    database (Append to a list of data)148 kB148 kB+93 B (+0.1%)
    database (Filtering data)147 kB147 kB+93 B (+0.1%)
    database (Listen for child events)163 kB164 kB+93 B (+0.1%)
    database (Listen for value events + Detach listeners)163 kB164 kB+93 B (+0.1%)
    database (Listen for value events)163 kB163 kB+93 B (+0.1%)
    database (Read data once)163 kB163 kB+93 B (+0.1%)
    database (Save data as transactions)165 kB165 kB+93 B (+0.1%)
    database (Sort data)149 kB149 kB+93 B (+0.1%)
    database (Write data)147 kB147 kB+93 B (+0.1%)
    firestore (Persistence)294 kB295 kB+879 B (+0.3%)
    firestore (Query Cursors)233 kB234 kB+631 B (+0.3%)
    firestore (Query)231 kB231 kB+631 B (+0.3%)
    firestore (Read data once)218 kB219 kB+567 B (+0.3%)
    firestore (Realtime updates)220 kB221 kB+567 B (+0.3%)
    firestore (Transaction)199 kB199 kB+472 B (+0.2%)
    firestore (Write data)198 kB199 kB+464 B (+0.2%)
    firestore-lite (Query Cursors)81.3 kB81.7 kB+397 B (+0.5%)
    firestore-lite (Query)77.5 kB77.8 kB+397 B (+0.5%)
    firestore-lite (Read data once)59.4 kB59.7 kB+289 B (+0.5%)
    firestore-lite (Transaction)84.0 kB84.5 kB+421 B (+0.5%)
    firestore-lite (Write data)68.9 kB69.3 kB+394 B (+0.6%)
    functions (call)30.9 kB31.0 kB+100 B (+0.3%)
    messaging (send + receive)46.4 kB46.5 kB+95 B (+0.2%)
    performance (trace)50.8 kB50.9 kB+95 B (+0.2%)
    remote-config (getAndFetch)45.4 kB45.4 kB+93 B (+0.2%)
    storage (getBytes)41.1 kB41.2 kB+93 B (+0.2%)
    storage (getDownloadURL)43.2 kB43.3 kB+93 B (+0.2%)
    storage (getMetadata)42.7 kB42.8 kB+93 B (+0.2%)
    storage (list + listAll)42.1 kB42.2 kB+93 B (+0.2%)
    storage (updateMetadata)42.9 kB43.0 kB+93 B (+0.2%)
    storage (uploadBytes)48.0 kB48.1 kB+93 B (+0.2%)
    storage (uploadBytesResumable)58.0 kB58.1 kB+93 B (+0.2%)
    storage (uploadString)48.2 kB48.3 kB+93 B (+0.2%)

  • firebase

    19 size changes

    TypeBase (c128eaa)Merge (9005380)Diff
    firebase-app-check-compat.js22.6 kB22.7 kB+101 B (+0.4%)
    firebase-app-check.js21.4 kB21.5 kB+104 B (+0.5%)
    firebase-app-compat.js28.8 kB28.9 kB+99 B (+0.3%)
    firebase-app.js92.8 kB93.1 kB+243 B (+0.3%)
    firebase-auth-compat.js126 kB126 kB+101 B (+0.1%)
    firebase-auth-cordova.js138 kB138 kB+96 B (+0.1%)
    firebase-auth-react-native.js150 kB150 kB+126 B (+0.1%)
    firebase-auth.js117 kB117 kB+101 B (+0.1%)
    firebase-compat.js760 kB761 kB+1.09 kB (+0.1%)
    firebase-database-compat.js166 kB166 kB+105 B (+0.1%)
    firebase-database.js154 kB154 kB+100 B (+0.1%)
    firebase-firestore-compat.js334 kB335 kB+1.08 kB (+0.3%)
    firebase-firestore-lite.js92.9 kB93.4 kB+493 B (+0.5%)
    firebase-firestore.js335 kB336 kB+1.09 kB (+0.3%)
    firebase-functions.js10.9 kB11.0 kB+91 B (+0.8%)
    firebase-performance-standalone-compat.es2017.js89.9 kB90.0 kB+106 B (+0.1%)
    firebase-performance-standalone-compat.js67.0 kB67.2 kB+140 B (+0.2%)
    firebase-storage-compat.js41.2 kB41.3 kB+101 B (+0.2%)
    firebase-storage.js40.2 kB40.3 kB+99 B (+0.2%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/g0A7YSqCjU.html

@milaGGL milaGGL requested a review from dconeybe January 31, 2023 18:47
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 31, 2023

Size Analysis Report 1

This report is too large (880,227 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/auKTH2k6eM.html

Copy link
Contributor

@dconeybe dconeybe left a comment

Choose a reason for hiding this comment

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

Just a few very minor comments.

packages/firestore/src/platform/base64.ts Outdated Show resolved Hide resolved
packages/firestore/src/platform/browser/base64.ts Outdated Show resolved Hide resolved
packages/firestore/src/remote/watch_change.ts Outdated Show resolved Hide resolved
packages/firestore/src/remote/watch_change.ts Outdated Show resolved Hide resolved
packages/firestore/src/core/database_info.ts Outdated Show resolved Hide resolved
@milaGGL milaGGL requested a review from dconeybe February 8, 2023 17:30
@milaGGL milaGGL merged commit 277f8e1 into mila/BloomFilter Feb 9, 2023
@milaGGL milaGGL deleted the mila/BloomFilter-optimization branch February 9, 2023 02:08
@firebase firebase locked and limited conversation to collaborators Mar 12, 2023
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.

3 participants