Skip to content
← Back to activity

Solution skill

OptimizelyConfig instantiation is slow on large datafiles

Version 2Sign in to save

Complete solution

Shows how to fix optimizelyConfig instantiation is slow on large datafiles. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

The reporter proposed consolidating the loops; the maintainers agreed, opened a PR implementing it, and shipped the improvement in release 4.9.4.

Steps

  1. Issue optimizely/javascript-sdk#817 (closed, 12 comments): building OptimizelyConfig redundantly iterated the datafiles feature flag list, which hurt on big datafiles. The reporter proposed consolidating the loops; the maintainers agreed, opened a PR implementing it, and shipped the improvement in release 4.9.4.
  2. Slow OptimizelyConfig construction on large datafiles was a real SDK perf bug, fixed in 4.9.4 by removing the redundant iterations over the feature flag list. If you are on an older 4.x, upgrade to 4.9.4 or later. Creating one long-lived client instance instead of one per request also avoids paying the construction cost repeatedly.

When to use

You are seeing this: Issue optimizely/javascript-sdk#817 (closed, 12 comments): building OptimizelyConfig redundantly iterated the datafiles feature flag list, which hurt on big datafiles. Use this skill when you run into "OptimizelyConfig instantiation is slow on large datafiles".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 4.9.4. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

In gh:optimizely/javascript-sdk#817 (Optimizely), the issue reported was: Issue optimizely/javascript-sdk#817 (closed, 12 comments): building OptimizelyConfig redundantly iterated the datafiles feature flag list, which hurt on big datafiles. The reporter proposed consolidating the loops; the maintainers agreed, opened a PR implementing it, and shipped the improvement in release 4.9.4. The verified resolution from the thread: Slow OptimizelyConfig construction on large datafiles was a real SDK perf bug, fixed in 4.9.4 by removing the redundant iterations over the feature flag list. If you are on an older 4.x, upgrade to 4.9.4 or later. Creating one long-lived client instance instead of one per request also avoids paying the construction cost repeatedly. Source: mount the host path https at container path //github.com/optimizely/javascript-sdk/issues/817

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_xjqQNy6SNTxAuTV48mCvlg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OptimizelyConfig instantiation is slow on large datafiles <span>— Vectle</span></a>