Skip to content

fix: gcir small perf fix #29

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions lib/client_initialize_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def self.get_responses(
end

def self.to_response(config_name, config_spec, evaluator, user, client_sdk_key, hash_algo, include_exposures, include_local_overrides)
config_name_str = config_name.to_s
category = config_spec[:type]
entity_type = config_spec[:entity]
if entity_type == Const::TYPE_SEGMENT || entity_type == Const::TYPE_HOLDOUT
Expand All @@ -47,6 +46,7 @@ def self.to_response(config_name, config_spec, evaluator, user, client_sdk_key,
end
end

config_name_str = config_name.to_s
if local_override.nil?
eval_result = ConfigResult.new(
name: config_name,
Expand Down Expand Up @@ -131,7 +131,7 @@ def self.populate_experiment_fields(config_name, config_spec, eval_result, resul
end

layer = evaluator.spec_store.layers[layer_name]
result[:value] = layer[:defaultValue].merge(result[:value])
result[:value] = result[:value].merge!(layer[:defaultValue])
end

def self.populate_layer_fields(config_spec, eval_result, result, evaluator, hash_algo, include_exposures)
Expand All @@ -153,13 +153,15 @@ def self.populate_layer_fields(config_spec, eval_result, result, evaluator, hash
end

def self.hash_name(name, hash_algo)
case hash_algo
when Statsig::Const::NONE
return name
when Statsig::Const::DJB2
return Statsig::HashUtils.djb2(name)
else
return Statsig::HashUtils.sha256(name)
Statsig::Memo.for_global(:hash_name, "#{hash_algo}|#{name}") do
case hash_algo
when Statsig::Const::NONE
name
when Statsig::Const::DJB2
Statsig::HashUtils.djb2(name)
else
Statsig::HashUtils.sha256(name)
end
end
end
end
Expand Down