<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>What is the most efficient between IF and showWhen=False ?</title><link>https://community.appian.com/discussions/f/best-practices/20648/what-is-the-most-efficient-between-if-and-showwhen-false</link><description>Hi, 
 My question is maybe a little naive but for increasing performance I was asking myself if use the showWhen attribute on 10 components is as good using an IF condition to masking all these components. 
 I took 3 examples : 
 1/ Case showWhen on all</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: What is the most efficient between IF and showWhen=False ?</title><link>https://community.appian.com/thread/80490?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 17:57:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f40452cc-65dd-4a3d-9d2b-0ac030f028d6</guid><dc:creator>cedric02</dc:creator><description>&lt;p&gt;Thanks a lot David for your reply&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the most efficient between IF and showWhen=False ?</title><link>https://community.appian.com/thread/80481?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 14:23:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:582e852c-45ae-4ec0-bf18-3cfb813eb7f5</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;Premature optimization is the root of all evil.&amp;nbsp; I just use showWhen quite extensively.&amp;nbsp; I did find one case, however, where showWhen didn&amp;#39;t behave as I intended, but if condition worked quite well.&amp;nbsp; I think there can be a difference between when a component and related code is hidden from the user, and when the if returns false so absolutely NONE of the associated code even runs.&lt;/p&gt;
&lt;p&gt;Unless you need to if(), a good example is when the component doesn&amp;#39;t have a showWhen, I would use showWhen.&amp;nbsp; It probably is the tiniest bit better, and certainly more maintainable, or Appian wouldn&amp;#39;t have bothered inventing it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the most efficient between IF and showWhen=False ?</title><link>https://community.appian.com/thread/80475?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 10:46:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6ed71a1c-b0eb-4381-bb2e-efcc42a9b661</guid><dc:creator>cedric02</dc:creator><description>&lt;p&gt;Thank you for your reply Stefan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the most efficient between IF and showWhen=False ?</title><link>https://community.appian.com/thread/80474?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 10:45:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:596a1a10-bc36-4a99-8847-0a0ea389b1d2</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;This is what I experienced in the past. Yes.&lt;/p&gt;
&lt;p&gt;When doing Performance optimizations, I pick the big candidates first. Most of the time these are issues in DB access or slow web services.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the most efficient between IF and showWhen=False ?</title><link>https://community.appian.com/thread/80473?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 10:41:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:88fe0db3-06db-4213-a76c-410f60dd5b16</guid><dc:creator>cedric02</dc:creator><description>&lt;p&gt;so Stefan you confirm, (leaving the readable aspect left aside) that the 1/ and 2/ cases (showwhen) are as much as efficient than the case 3/ (using the IF) ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the most efficient between IF and showWhen=False ?</title><link>https://community.appian.com/thread/80472?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 10:37:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e7eb1c60-eadb-47e8-9e07-51c2f0c60679</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;AFAIK this will not have any significant impact on performance. I try to create readable code. And putting showwhens into a larger number of components is not readable/understandable.&lt;/p&gt;
&lt;p&gt;I created by own component which just takes a number of components and a showWhen. It does nothing else then showing/hiding a bunch of components. Works pretty well in cases where I do not want to add any layout or section.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>