No announcement yet.

Code Template vs Transformer Code for Efficiency

  • Filter
  • Time
  • Show
Clear All
new posts

  • Code Template vs Transformer Code for Efficiency

    Is it more efficient speed/processing wise to add javascript functions directly into my Transformer or via a Code Template. I have many functions that are reference by all of my Channels? I am currently using Mirth 3.2.2

  • #2
    I'd suggest upgrading to 3.3, because we have made quite a few enhancements to code templates. In particular, do this:
    • Set the context on each code template so that they are only used where needed. For example, if you have a template that you would only ever use in the channel postprocessor script, then check that box and leave the others all unchecked.
    • Organize your code templates into libraries as appropriate.
    • On the library settings, only include them on the channels that need them, instead of allowing libraries to needlessly be included on all channels all the time.

    Doing all of that in 3.3+ allows you to minimize overhead for the compiled script cache, and also it will maximize efficiency for any channel using JavaScript. For example if you have 100 code templates and a channel only happens to use one of them, by default it's still going to include all of those templates in the compiled script. All-in-all it's not a huge save, but it's not trivial either.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

    - How do I foo?
    - You just bar.