This message was deleted.
# ask-questions
w
This message was deleted.
f
Our SDKs don't do a network request to determine variations. We use deterministic hashing, which takes less than a millisecond to compute.
Here's pseudocode using NodeJS, but the other SDKs are similar. Zero network requests are made.
Copy code
const growthbook = new GrowthBook();

for (let i=0; i<50000; i++) {
  const email = i + "@gmail.com"; // TODO: pull from CSV

  growthbook.setAttributes({
    id: email
  });

  const result = growthbook.run({
    key: "my-experiment",
    variations: ["A", "B"]
  });

  sendEmail(email, result.value); // "A" or "B"
}
s
Thank you for the quick response! I might have misunderstood the workflow a bit, it seems. It's great news that the hashing is performed client-side! If I understood correctly, in case that experiments are declared through the Growthbook UI, I should fetch the experiment and variant data through an API call, cache that data somewhere (e.g. a database) and then use that data to construct inline
Experiment
objects at appropriate places and run the experiment for each user?
f
The inline experiments are if you want to control experiments directly through code without using the GrowthBook UI. You can also run the experiment through feature flags if you want. Cache the JSON feature definitions from the API, then use it as follows:
Copy code
const growthbook = new GrowthBook({
  features: featuresJSONFromCache
})

for (let i=0; i<50000; i++) {
  const email = i + "@gmail.com"; // TODO: pull from CSV

  growthbook.setAttributes({
    id: email
  });

  const variation = growthbook.getFeatureValue("my-feature", "A")

  sendEmail(email, variation);
}
s
Excellent. Thank you very much for the assistance!
172 Views