Script Params vs Constant Hash in Script

I need to translate from one set of values to another. I would use the translate filter plugin but I need to keep the original value if no translation is found instead of nil.
So my code is:

TRANSLATE_MAP = {
"foo" => "bar",
"dead" => "beef",
...
}

def filter(event)
  # use TRANSLATE_MAP
  event.set(...)

My question is whether it is more efficient with respect to memory, performance, etc. to do it like this or perhaps to pass the map as a script_params value because I don't know if TRANSLATE_MAP is created once or every time script is called. Similarly for script_params.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.