Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 507077

Summary: [xtend][templates] Performance improvement by not emitting indentation strings
Product: [Tools] Xtend Reporter: Michael Vorburger <mike>
Component: CoreAssignee: Project Inbox <xtend-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: christian.dietrich.opensource, karsten.thoms, nite
Version: 2.9.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://github.com/eclipse/xtext-xtend/pull/69
https://github.com/eclipse/xtext-core/pull/207
https://github.com/eclipse/xtext-eclipse/pull/143
https://github.com/eclipse/xtext-extras/pull/81
https://github.com/eclipse/xtext-lib/pull/29
https://github.com/eclipse/xtext-web/pull/25
https://github.com/eclipse/xtext-xtend/pull/99
Whiteboard: v2.11

Description Michael Vorburger CLA 2016-11-04 13:56:06 EDT
(I'm filing this issue on behalf of Robert Varga, who is about to but doesn't have an eclipse.org account yet; "Due to SPAM if you are a *NEW* user and wish to file bugs you will need to contact webmaster at eclipse dot org to be granted permission. All other users should be unaffected by this change." <= he's been waiting to hear back for 3 days..)


Java code generated from Xtend routinely contains output like:

       public CharSequence packageDefinition() {
           StringConcatenation _builder = new StringConcatenation();
           _builder.append("package ");
           String _packageName = this.type.getPackageName();
          _builder.append(_packageName, "");
          _builder.append(";");
          return _builder;
       }

While StringConcatenation will detect the fact the indentation string is empty, it is at the cost of runtime performance.

Before emitting the call to StringConcatenation, check if our literal would end up being an empty string.


A Pull Request with a concrete proposal to improve performance of Xtend templates based on above is about to be submitted on Git Hub.
Comment 1 Michael Vorburger CLA 2016-11-04 13:59:26 EDT
FYI There is some other Xtend template performance work in bug 427909 ..
Comment 2 Eclipse Genie CLA 2016-11-04 14:02:25 EDT
GitHub Pull Request 69 created by [rovarga]
https://github.com/eclipse/xtext-xtend/pull/69
Comment 3 Eclipse Genie CLA 2016-12-19 10:05:35 EST
GitHub Pull Request 207 created by [kthoms]
https://github.com/eclipse/xtext-core/pull/207
Comment 4 Eclipse Genie CLA 2016-12-19 10:05:49 EST
GitHub Pull Request 143 created by [kthoms]
https://github.com/eclipse/xtext-eclipse/pull/143
Comment 5 Eclipse Genie CLA 2016-12-19 10:06:03 EST
GitHub Pull Request 81 created by [kthoms]
https://github.com/eclipse/xtext-extras/pull/81
Comment 6 Eclipse Genie CLA 2016-12-19 10:06:17 EST
GitHub Pull Request 29 created by [kthoms]
https://github.com/eclipse/xtext-lib/pull/29
From: genie@eclipse.org
Subject: [Bug 507077]

@id = 507077
@see_also = https://github.com/eclipse/xtext-idea/pull/24

GitHub Pull Request 24 created by [kthoms]
https://github.com/eclipse/xtext-idea/pull/24
Comment 7 Eclipse Genie CLA 2016-12-19 10:06:30 EST
GitHub Pull Request 25 created by [kthoms]
https://github.com/eclipse/xtext-web/pull/25
Comment 8 Eclipse Genie CLA 2016-12-19 10:06:43 EST
GitHub Pull Request 99 created by [kthoms]
https://github.com/eclipse/xtext-xtend/pull/99
Comment 9 Christian Dietrich CLA 2017-02-09 04:19:04 EST
@kthoms is there something left for this?
Comment 10 Karsten Thoms CLA 2017-04-05 09:27:56 EDT
Fixed in 2.11