Why is Rule Engine faster than Column Expressions?

Hi folks,

Could anyone explain why Rule Engine is faster than Column Expressions for my logic?

I can see that for loop with 122 iterations (6 columns table) - Rule Engine did it in 1sec, while Column Expressions - around 7sec?

Rule Engine

  • ($field1$=$field2$ AND $field3$=$field4$) => TRUE
  • TRUE => FALSE

Column Expressions

  • column(“field1”)==column(“field2”) &&
  • column(“field3”)==column(“field4”)

Thank you in advance!

BR,
Egor

Hello @larine,

and welcome to KNIME Community!

Well I’m not a developer (so someone will hopefully correct me if I say something utterly wrong) but would say it’s because Column Expressions is based on JavaScript and Rule Engine is based on Java while KNIME (which is based on Eclipse) is Java based so every node that uses Java underneath is faster (or at least should be if implementation is proper) than node which does not use it (and of course both do same calculation). Makes sense?

I like Column Expressions very much as it offers possibility to replace many nodes using multiple logical expressions with calculation together with some fancy functions but I suggest to use “Java” nodes like Rule Engine, Math Formula, String Manipulation in case of loops and processing huge amounts of data. Especially for your use case where you only need to use one node to replace your logic from Column Expressions node.

And Column Expressions actually did get significant speedup with KNIME 4.2.1 so if using older version consider updating.
Column Expression Speedup with 4.2.1)

Hope this helps!

Br,
Ivan

4 Likes

Thanks @ipazin for explanation. That make sense.

I was also thinking because of JS vs Java but was not sure.
Is there a way to define if the node is based on JS vs Java/Eclipse? Like only reading the node description or is there a way to define it “visually”.

BTW I have 4.2.2 version.

1 Like

Hello @larine,

glad that makes sense. At first glance and to my knowledge only Column Expressions and some visualization nodes use JavaScript so you are safe to assume others nodes are based on Java. And if there is something special/different there is node description where it should be noted.

Br,
Ivan

1 Like

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