SlideShare a Scribd company logo
1 of 37
Download to read offline
Martin Lippert	

Principal Software Engineer - Pivotal	

mlippert@gopivotal.com	

@martinlippert

Optimizing	

Performance	

how to make your Eclipsebased tools run faster
Every developer benefits
from better performance
Find out where the problem is...

failblog.com
Measure !!!
VisualVM
!

Free	

Easy to use	

comes as part of the JDK	

extremely useful to capture data remotely
YourKit

used for comprehensive analysis	

various options and ways to track down issues	

$$$	

!
!

alternative:	


JProfiler
$$$
the case
trivial: expensive calls inside loops
findFilesForLocationURI(..) is slow

step 1: fix this in the Eclipse platform
findFilesForLocationURI(..) is slow

step 2: cache results if that makes sense
findFilesForLocationURI(..) is slow
step 3: if you can‘t avoid massive use of this,

optimize for the most likely case
Build workspace (16%)...

why is the build taking	

soooooo long... ???
Build workspace (16%)...
Build workspace (16%)...
taken from a different case

what is exactly going on under the hood?
Build workspace (16%)...
taken from a different case

what is exactly going on under the hood?
•

the Spring-specific builder: sloooooow...
Build workspace (16%)...
taken from a different case

what is exactly going on under the hood?
•

•

the Spring-specific builder: sloooooow...

the Maven project builder: slooooow...

•

the WTP JS builder: slooooow...
Build workspace (16%)...
taken from a different case

what is exactly going on under the hood?
•

•

the Spring-specific builder: sloooooow...

the Maven project builder: slooooow...

•

the WTP JS builder: slooooow...

•

the core implementation is ultra fast (compiling
Java, for example, but also reconciling, invoking
content assist, etc.)
But wait a moment...
But wait a moment...

what is this ?!?
Action 1: Configure your Eclipse wisely

max heap size

build workspace

-Xmx768m

30min

!

!

!

!

!

!

-Xmx1024m

~7min
Action 2: Reduce garbage
and memory usage in general

•
•
•

String.format creates a lot of garbage 	

called many many times 	

most of the time with exactly one argument
Action 2: Reduce garbage
and memory usage in general











public Set<IBean> getBeans() {

 Set<IBean> allBeans = new LinkedHashSet<IBean>(beans.values());

 for (IBeansImport beansImport : imports) {

 
 for (IBeansConfig bc : beansImport.getImportedBeansConfigs()) {

 
 
 allBeans.addAll(bc.getBeans());

 
 }

 }

 return Collections.unmodifiableSet(allBeans);
}
Action 2: Reduce garbage
and memory usage in general
new set with copied content











public Set<IBean> getBeans() {

 Set<IBean> allBeans = new LinkedHashSet<IBean>(beans.values());

 for (IBeansImport beansImport : imports) {

 
 for (IBeansConfig bc : beansImport.getImportedBeansConfigs()) {

 
 
 allBeans.addAll(bc.getBeans());

 
 }

 }

 return Collections.unmodifiableSet(allBeans);
}
recursive call

•
•

imagine this is called with deep recursion
but since the method looks quite innocent, it is called
many times while doing the build
Now back to the details of this…

•

the Spring-specific builder: sloooooow...
O(n)
matters for scalability
watch out for visitors


class ResourceDeltaVisitor implements IResourceDeltaVisitor {

















}

!

public boolean visit(IResourceDelta aDelta) throws CoreException {

IResource resource = aDelta.getResource();

if (resource instanceof IFile) {


checkResource(resource);

}

return true;
}
watch out for visitors


class ResourceDeltaVisitor implements IResourceDeltaVisitor {

















}

!

public boolean visit(IResourceDelta aDelta) throws CoreException {

IResource resource = aDelta.getResource();

if (resource instanceof IFile) {


checkResource(resource);

}

return true;
}

•
•
•

this might be called many many times	

take care to make this simple and fast	

not allowed to iterate over collections
watch out for visitors


class ResourceDeltaVisitor implements IResourceDeltaVisitor {

















}

!

•

public boolean visit(IResourceDelta aDelta) throws CoreException {

IResource resource = aDelta.getResource();

if (resource instanceof IFile) {


checkResource(resource);

}

return true;
}

•
•
•

this might be called many many times	

take care to make this simple and fast	

not allowed to iterate over collections

in our case:
• takes a look at individual IResource objects
• identify the defined types
• iterate over all defined beans and check for type
dependency
the case: type checks


Set<IType> typesToCheck = new HashSet<IType>();









IType[] types = cu.getAllTypes();
for (IType type : types) {

IType[] subTypes = type.newTypeHierarchy(monitor).getAllSubtypes(type);

if (subTypes != null && subTypes.length > 0) {


typesToCheck.addAll(Arrays.asList(subTypes));

}
}

!

!
!

loop over beans and check each bean type whether it is contained in
typesToCheck
the case: type checks


Set<IType> typesToCheck = new HashSet<IType>();









IType[] types = cu.getAllTypes();
for (IType type : types) {

IType[] subTypes = type.newTypeHierarchy(monitor).getAllSubtypes(type);

if (subTypes != null && subTypes.length > 0) {


typesToCheck.addAll(Arrays.asList(subTypes));

}
}

!

!
!

loop over beans and check each bean type whether it is contained in
typesToCheck

•
•
•

asking a type for its hierarchy is slow	

cached, but only for a limited number of hierarchies	

doing this for all resources of a build can take a very long time
instead:
we built our own type hierarchy engine
TypeHierarchyEngine
it reads bytecode (only type information)	

it walks up the super classes and interfaces	

it caches already loaded type information
instead:
we built our own type hierarchy engine
TypeHierarchyEngine
it reads bytecode (only type information)	

it walks up the super classes and interfaces	

it caches already loaded type information
Lessons Learned
reading bytecode is super super fast	

finding the bytecode on the classpath is super slow
What is designed to be fast?

Reconciling

Be extremely careful when implementing a
reconcile participant	

!

Content-Assist

Has to be fast	

Don‘t do anything if its not your job	

!

...
Startup time is important

(even if you start Eclipse just once a day)	

!
!

Don‘t start

all your bundles and do stuff at startup	

!

Do caching

(Equinox Weaving, for example)	

!

Uninstall bundles

to get rid of things you don‘t need
A different approach
Proposal mock-up – not an actual program

from Chris Laffras talk on Eclipse performance
1.Measure
2.Optimize
!

3.Goto 1.
Q&A
!
and thank you for your attention

Martin Lippert	

Principal Software Engineer - Pivotal	

mlippert@gopivotal.com	

@martinlippert

More Related Content

What's hot

Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action scriptChristophe Herreman
 
Programming JVM Bytecode with Jitescript
Programming JVM Bytecode with JitescriptProgramming JVM Bytecode with Jitescript
Programming JVM Bytecode with JitescriptJoe Kutner
 
The core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaThe core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaMite Mitreski
 
Programming JVM Bytecode
Programming JVM BytecodeProgramming JVM Bytecode
Programming JVM BytecodeJoe Kutner
 
Scala101, first steps with Scala
Scala101, first steps with ScalaScala101, first steps with Scala
Scala101, first steps with ScalaGiampaolo Trapasso
 
Google guava - almost everything you need to know
Google guava - almost everything you need to knowGoogle guava - almost everything you need to know
Google guava - almost everything you need to knowTomasz Dziurko
 
JDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done Right
JDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done RightJDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done Right
JDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done RightPROIDEA
 
Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Roy Yu
 

What's hot (10)

AssertJ quick introduction
AssertJ quick introductionAssertJ quick introduction
AssertJ quick introduction
 
Scala, just a better java?
Scala, just a better java?Scala, just a better java?
Scala, just a better java?
 
Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action script
 
Programming JVM Bytecode with Jitescript
Programming JVM Bytecode with JitescriptProgramming JVM Bytecode with Jitescript
Programming JVM Bytecode with Jitescript
 
The core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaThe core libraries you always wanted - Google Guava
The core libraries you always wanted - Google Guava
 
Programming JVM Bytecode
Programming JVM BytecodeProgramming JVM Bytecode
Programming JVM Bytecode
 
Scala101, first steps with Scala
Scala101, first steps with ScalaScala101, first steps with Scala
Scala101, first steps with Scala
 
Google guava - almost everything you need to know
Google guava - almost everything you need to knowGoogle guava - almost everything you need to know
Google guava - almost everything you need to know
 
JDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done Right
JDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done RightJDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done Right
JDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done Right
 
Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101
 

Viewers also liked

JAX 2013: Modern Architectures with Spring and JavaScript
JAX 2013: Modern Architectures with Spring and JavaScriptJAX 2013: Modern Architectures with Spring and JavaScript
JAX 2013: Modern Architectures with Spring and JavaScriptmartinlippert
 
JAX 2013: Introducing Eclipse Orion
JAX 2013: Introducing Eclipse OrionJAX 2013: Introducing Eclipse Orion
JAX 2013: Introducing Eclipse Orionmartinlippert
 
Jax2013 PaaS-Parade - Part 1: Cloud Foundry
Jax2013 PaaS-Parade - Part 1: Cloud FoundryJax2013 PaaS-Parade - Part 1: Cloud Foundry
Jax2013 PaaS-Parade - Part 1: Cloud Foundrymartinlippert
 
Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptmartinlippert
 
Scripted - Embracing Eclipse Orion
Scripted - Embracing Eclipse OrionScripted - Embracing Eclipse Orion
Scripted - Embracing Eclipse Orionmartinlippert
 
Spring Tooling: What's new and what's coming
Spring Tooling: What's new and what's comingSpring Tooling: What's new and what's coming
Spring Tooling: What's new and what's comingmartinlippert
 
WJAX 2013: Java8-Tooling in Eclipse
WJAX 2013: Java8-Tooling in EclipseWJAX 2013: Java8-Tooling in Eclipse
WJAX 2013: Java8-Tooling in Eclipsemartinlippert
 
EclipseCon-Europe 2013: Making the Eclipse IDE fun again
EclipseCon-Europe 2013: Making the Eclipse IDE fun againEclipseCon-Europe 2013: Making the Eclipse IDE fun again
EclipseCon-Europe 2013: Making the Eclipse IDE fun againmartinlippert
 
WJAX 2013: Die PaaS-Parade - Teil 2 - Cloud Foundry
WJAX 2013: Die PaaS-Parade - Teil 2 - Cloud FoundryWJAX 2013: Die PaaS-Parade - Teil 2 - Cloud Foundry
WJAX 2013: Die PaaS-Parade - Teil 2 - Cloud Foundrymartinlippert
 

Viewers also liked (10)

Home- (office) ?
Home- (office) ?Home- (office) ?
Home- (office) ?
 
JAX 2013: Modern Architectures with Spring and JavaScript
JAX 2013: Modern Architectures with Spring and JavaScriptJAX 2013: Modern Architectures with Spring and JavaScript
JAX 2013: Modern Architectures with Spring and JavaScript
 
JAX 2013: Introducing Eclipse Orion
JAX 2013: Introducing Eclipse OrionJAX 2013: Introducing Eclipse Orion
JAX 2013: Introducing Eclipse Orion
 
Jax2013 PaaS-Parade - Part 1: Cloud Foundry
Jax2013 PaaS-Parade - Part 1: Cloud FoundryJax2013 PaaS-Parade - Part 1: Cloud Foundry
Jax2013 PaaS-Parade - Part 1: Cloud Foundry
 
Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScript
 
Scripted - Embracing Eclipse Orion
Scripted - Embracing Eclipse OrionScripted - Embracing Eclipse Orion
Scripted - Embracing Eclipse Orion
 
Spring Tooling: What's new and what's coming
Spring Tooling: What's new and what's comingSpring Tooling: What's new and what's coming
Spring Tooling: What's new and what's coming
 
WJAX 2013: Java8-Tooling in Eclipse
WJAX 2013: Java8-Tooling in EclipseWJAX 2013: Java8-Tooling in Eclipse
WJAX 2013: Java8-Tooling in Eclipse
 
EclipseCon-Europe 2013: Making the Eclipse IDE fun again
EclipseCon-Europe 2013: Making the Eclipse IDE fun againEclipseCon-Europe 2013: Making the Eclipse IDE fun again
EclipseCon-Europe 2013: Making the Eclipse IDE fun again
 
WJAX 2013: Die PaaS-Parade - Teil 2 - Cloud Foundry
WJAX 2013: Die PaaS-Parade - Teil 2 - Cloud FoundryWJAX 2013: Die PaaS-Parade - Teil 2 - Cloud Foundry
WJAX 2013: Die PaaS-Parade - Teil 2 - Cloud Foundry
 

Similar to Optimizing Eclipse Performance by Measuring and Reducing Garbage

Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIsDmitry Buzdin
 
Why Spring <3 Kotlin
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 KotlinVMware Tanzu
 
Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)Oliver Klee
 
Sharepoint Saturday India Online best practice for developing share point sol...
Sharepoint Saturday India Online best practice for developing share point sol...Sharepoint Saturday India Online best practice for developing share point sol...
Sharepoint Saturday India Online best practice for developing share point sol...Shakir Majeed Khan
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartGabriele Lana
 
Test-driven Development for TYPO3
Test-driven Development for TYPO3Test-driven Development for TYPO3
Test-driven Development for TYPO3Oliver Klee
 
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is FineCocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is FineChris Adamson
 
Боремся с NPE вместе с Kotlin, Павел Шацких СберТех
Боремся с NPE вместе с Kotlin, Павел Шацких СберТехБоремся с NPE вместе с Kotlin, Павел Шацких СберТех
Боремся с NPE вместе с Kotlin, Павел Шацких СберТехСбертех | SberTech
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadOliver Daff
 
Asynchronous Programming at Netflix
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at NetflixC4Media
 
Lists and scrollbars
Lists and scrollbarsLists and scrollbars
Lists and scrollbarsmyrajendra
 
Firebase & SwiftUI Workshop
Firebase & SwiftUI WorkshopFirebase & SwiftUI Workshop
Firebase & SwiftUI WorkshopPeter Friese
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろうUnity Technologies Japan K.K.
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development Alberto De Bortoli
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsKonrad Malawski
 

Similar to Optimizing Eclipse Performance by Measuring and Reducing Garbage (20)

Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIs
 
Why Spring <3 Kotlin
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 Kotlin
 
Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)
 
Sharepoint Saturday India Online best practice for developing share point sol...
Sharepoint Saturday India Online best practice for developing share point sol...Sharepoint Saturday India Online best practice for developing share point sol...
Sharepoint Saturday India Online best practice for developing share point sol...
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 
Twig tips and tricks
Twig tips and tricksTwig tips and tricks
Twig tips and tricks
 
Test-driven Development for TYPO3
Test-driven Development for TYPO3Test-driven Development for TYPO3
Test-driven Development for TYPO3
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is FineCocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
 
Боремся с NPE вместе с Kotlin, Павел Шацких СберТех
Боремся с NPE вместе с Kotlin, Павел Шацких СберТехБоремся с NPE вместе с Kotlin, Павел Шацких СберТех
Боремся с NPE вместе с Kotlin, Павел Шацких СберТех
 
Kotlin
KotlinKotlin
Kotlin
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
 
Asynchronous Programming at Netflix
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at Netflix
 
Lists and scrollbars
Lists and scrollbarsLists and scrollbars
Lists and scrollbars
 
Attribute
AttributeAttribute
Attribute
 
Firebase & SwiftUI Workshop
Firebase & SwiftUI WorkshopFirebase & SwiftUI Workshop
Firebase & SwiftUI Workshop
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development
 
Java 8: the good parts!
Java 8: the good parts!Java 8: the good parts!
Java 8: the good parts!
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
 

More from martinlippert

PaaS Parade - Cloud Foundry
PaaS Parade - Cloud FoundryPaaS Parade - Cloud Foundry
PaaS Parade - Cloud Foundrymartinlippert
 
Browser and Cloud - The Future of IDEs?
Browser and Cloud - The Future of IDEs?Browser and Cloud - The Future of IDEs?
Browser and Cloud - The Future of IDEs?martinlippert
 
Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptmartinlippert
 
What's new with tooling for Spring, Grails, and the Cloud
What's new with tooling for Spring, Grails, and the CloudWhat's new with tooling for Spring, Grails, and the Cloud
What's new with tooling for Spring, Grails, and the Cloudmartinlippert
 
Tooling for the JavaScript Era
Tooling for the JavaScript EraTooling for the JavaScript Era
Tooling for the JavaScript Eramartinlippert
 
Embracing Eclipse Orion
Embracing Eclipse OrionEmbracing Eclipse Orion
Embracing Eclipse Orionmartinlippert
 
Why SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptWhy SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptmartinlippert
 
JAX 2012: Moderne Architektur mit Spring und JavaScript
JAX 2012: Moderne Architektur mit Spring und JavaScriptJAX 2012: Moderne Architektur mit Spring und JavaScript
JAX 2012: Moderne Architektur mit Spring und JavaScriptmartinlippert
 
JAX 2012: Pimp Your IDE Productivity
JAX 2012: Pimp Your IDE ProductivityJAX 2012: Pimp Your IDE Productivity
JAX 2012: Pimp Your IDE Productivitymartinlippert
 
WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...
WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...
WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...martinlippert
 
Spring Tooling Update - New & Noteworty (at SpringOne 2011)
Spring Tooling Update - New & Noteworty (at SpringOne 2011)Spring Tooling Update - New & Noteworty (at SpringOne 2011)
Spring Tooling Update - New & Noteworty (at SpringOne 2011)martinlippert
 
Classloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGiClassloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGimartinlippert
 

More from martinlippert (12)

PaaS Parade - Cloud Foundry
PaaS Parade - Cloud FoundryPaaS Parade - Cloud Foundry
PaaS Parade - Cloud Foundry
 
Browser and Cloud - The Future of IDEs?
Browser and Cloud - The Future of IDEs?Browser and Cloud - The Future of IDEs?
Browser and Cloud - The Future of IDEs?
 
Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScript
 
What's new with tooling for Spring, Grails, and the Cloud
What's new with tooling for Spring, Grails, and the CloudWhat's new with tooling for Spring, Grails, and the Cloud
What's new with tooling for Spring, Grails, and the Cloud
 
Tooling for the JavaScript Era
Tooling for the JavaScript EraTooling for the JavaScript Era
Tooling for the JavaScript Era
 
Embracing Eclipse Orion
Embracing Eclipse OrionEmbracing Eclipse Orion
Embracing Eclipse Orion
 
Why SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptWhy SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScript
 
JAX 2012: Moderne Architektur mit Spring und JavaScript
JAX 2012: Moderne Architektur mit Spring und JavaScriptJAX 2012: Moderne Architektur mit Spring und JavaScript
JAX 2012: Moderne Architektur mit Spring und JavaScript
 
JAX 2012: Pimp Your IDE Productivity
JAX 2012: Pimp Your IDE ProductivityJAX 2012: Pimp Your IDE Productivity
JAX 2012: Pimp Your IDE Productivity
 
WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...
WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...
WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo...
 
Spring Tooling Update - New & Noteworty (at SpringOne 2011)
Spring Tooling Update - New & Noteworty (at SpringOne 2011)Spring Tooling Update - New & Noteworty (at SpringOne 2011)
Spring Tooling Update - New & Noteworty (at SpringOne 2011)
 
Classloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGiClassloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGi
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

Optimizing Eclipse Performance by Measuring and Reducing Garbage

  • 1. Martin Lippert Principal Software Engineer - Pivotal mlippert@gopivotal.com @martinlippert Optimizing Performance how to make your Eclipsebased tools run faster
  • 2. Every developer benefits from better performance
  • 3. Find out where the problem is... failblog.com
  • 5. VisualVM ! Free Easy to use comes as part of the JDK extremely useful to capture data remotely
  • 6. YourKit used for comprehensive analysis various options and ways to track down issues $$$ ! ! alternative: JProfiler $$$
  • 9. findFilesForLocationURI(..) is slow step 1: fix this in the Eclipse platform
  • 10. findFilesForLocationURI(..) is slow step 2: cache results if that makes sense
  • 11. findFilesForLocationURI(..) is slow step 3: if you can‘t avoid massive use of this,
 optimize for the most likely case
  • 12. Build workspace (16%)... why is the build taking soooooo long... ???
  • 14. Build workspace (16%)... taken from a different case what is exactly going on under the hood?
  • 15. Build workspace (16%)... taken from a different case what is exactly going on under the hood? • the Spring-specific builder: sloooooow...
  • 16. Build workspace (16%)... taken from a different case what is exactly going on under the hood? • • the Spring-specific builder: sloooooow... the Maven project builder: slooooow... • the WTP JS builder: slooooow...
  • 17. Build workspace (16%)... taken from a different case what is exactly going on under the hood? • • the Spring-specific builder: sloooooow... the Maven project builder: slooooow... • the WTP JS builder: slooooow... • the core implementation is ultra fast (compiling Java, for example, but also reconciling, invoking content assist, etc.)
  • 18. But wait a moment...
  • 19. But wait a moment... what is this ?!?
  • 20. Action 1: Configure your Eclipse wisely max heap size build workspace -Xmx768m 30min ! ! ! ! ! ! -Xmx1024m ~7min
  • 21. Action 2: Reduce garbage and memory usage in general • • • String.format creates a lot of garbage called many many times most of the time with exactly one argument
  • 22. Action 2: Reduce garbage and memory usage in general public Set<IBean> getBeans() { Set<IBean> allBeans = new LinkedHashSet<IBean>(beans.values()); for (IBeansImport beansImport : imports) { for (IBeansConfig bc : beansImport.getImportedBeansConfigs()) { allBeans.addAll(bc.getBeans()); } } return Collections.unmodifiableSet(allBeans); }
  • 23. Action 2: Reduce garbage and memory usage in general new set with copied content public Set<IBean> getBeans() { Set<IBean> allBeans = new LinkedHashSet<IBean>(beans.values()); for (IBeansImport beansImport : imports) { for (IBeansConfig bc : beansImport.getImportedBeansConfigs()) { allBeans.addAll(bc.getBeans()); } } return Collections.unmodifiableSet(allBeans); } recursive call • • imagine this is called with deep recursion but since the method looks quite innocent, it is called many times while doing the build
  • 24. Now back to the details of this… • the Spring-specific builder: sloooooow...
  • 26. watch out for visitors class ResourceDeltaVisitor implements IResourceDeltaVisitor { } ! public boolean visit(IResourceDelta aDelta) throws CoreException { IResource resource = aDelta.getResource(); if (resource instanceof IFile) { checkResource(resource); } return true; }
  • 27. watch out for visitors class ResourceDeltaVisitor implements IResourceDeltaVisitor { } ! public boolean visit(IResourceDelta aDelta) throws CoreException { IResource resource = aDelta.getResource(); if (resource instanceof IFile) { checkResource(resource); } return true; } • • • this might be called many many times take care to make this simple and fast not allowed to iterate over collections
  • 28. watch out for visitors class ResourceDeltaVisitor implements IResourceDeltaVisitor { } ! • public boolean visit(IResourceDelta aDelta) throws CoreException { IResource resource = aDelta.getResource(); if (resource instanceof IFile) { checkResource(resource); } return true; } • • • this might be called many many times take care to make this simple and fast not allowed to iterate over collections in our case: • takes a look at individual IResource objects • identify the defined types • iterate over all defined beans and check for type dependency
  • 29. the case: type checks Set<IType> typesToCheck = new HashSet<IType>(); IType[] types = cu.getAllTypes(); for (IType type : types) { IType[] subTypes = type.newTypeHierarchy(monitor).getAllSubtypes(type); if (subTypes != null && subTypes.length > 0) { typesToCheck.addAll(Arrays.asList(subTypes)); } } ! ! ! loop over beans and check each bean type whether it is contained in typesToCheck
  • 30. the case: type checks Set<IType> typesToCheck = new HashSet<IType>(); IType[] types = cu.getAllTypes(); for (IType type : types) { IType[] subTypes = type.newTypeHierarchy(monitor).getAllSubtypes(type); if (subTypes != null && subTypes.length > 0) { typesToCheck.addAll(Arrays.asList(subTypes)); } } ! ! ! loop over beans and check each bean type whether it is contained in typesToCheck • • • asking a type for its hierarchy is slow cached, but only for a limited number of hierarchies doing this for all resources of a build can take a very long time
  • 31. instead: we built our own type hierarchy engine TypeHierarchyEngine it reads bytecode (only type information) it walks up the super classes and interfaces it caches already loaded type information
  • 32. instead: we built our own type hierarchy engine TypeHierarchyEngine it reads bytecode (only type information) it walks up the super classes and interfaces it caches already loaded type information Lessons Learned reading bytecode is super super fast finding the bytecode on the classpath is super slow
  • 33. What is designed to be fast? Reconciling Be extremely careful when implementing a reconcile participant ! Content-Assist Has to be fast Don‘t do anything if its not your job ! ...
  • 34. Startup time is important (even if you start Eclipse just once a day) ! ! Don‘t start all your bundles and do stuff at startup ! Do caching (Equinox Weaving, for example) ! Uninstall bundles to get rid of things you don‘t need
  • 35. A different approach Proposal mock-up – not an actual program from Chris Laffras talk on Eclipse performance
  • 37. Q&A ! and thank you for your attention Martin Lippert Principal Software Engineer - Pivotal mlippert@gopivotal.com @martinlippert