EclipseCon-Europe 2013: Optimizing performance - how to make your Eclipse-based tools run fasterEce2013 optimizing performance

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
1 von 37

Recomendados

Google Guava & EMF @ GTUG Nantes von
Google Guava & EMF @ GTUG NantesGoogle Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG Nantesmikaelbarbero
10.7K views154 Folien
Elixir: the not-so-hidden path to Erlang von
Elixir: the not-so-hidden path to ErlangElixir: the not-so-hidden path to Erlang
Elixir: the not-so-hidden path to ErlangLaura M. Castro
376 views39 Folien
Google guava von
Google guavaGoogle guava
Google guavaThomas Ferris Nicolaisen
9.8K views27 Folien
知っておきたいSpring Batch Tips von
知っておきたいSpring Batch Tips知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tipsikeyat
1.4K views42 Folien
MVest Spring Job Execution von
MVest Spring Job ExecutionMVest Spring Job Execution
MVest Spring Job ExecutionShraddha Bora
159 views9 Folien
Beautiful code von
Beautiful codeBeautiful code
Beautiful codePeter Hilton
901 views37 Folien

Más contenido relacionado

Was ist angesagt?

AssertJ quick introduction von
AssertJ quick introductionAssertJ quick introduction
AssertJ quick introductionThiago Schoppen Veronese
740 views12 Folien
Scala, just a better java? von
Scala, just a better java?Scala, just a better java?
Scala, just a better java?Giampaolo Trapasso
981 views39 Folien
Stuff you didn't know about action script von
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action scriptChristophe Herreman
7.1K views37 Folien
Programming JVM Bytecode with Jitescript von
Programming JVM Bytecode with JitescriptProgramming JVM Bytecode with Jitescript
Programming JVM Bytecode with JitescriptJoe Kutner
966 views104 Folien
The core libraries you always wanted - Google Guava von
The core libraries you always wanted - Google GuavaThe core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaMite Mitreski
1K views47 Folien
Programming JVM Bytecode von
Programming JVM BytecodeProgramming JVM Bytecode
Programming JVM BytecodeJoe Kutner
1.4K views100 Folien

Was ist angesagt?(10)

Programming JVM Bytecode with Jitescript von Joe Kutner
Programming JVM Bytecode with JitescriptProgramming JVM Bytecode with Jitescript
Programming JVM Bytecode with Jitescript
Joe Kutner966 views
The core libraries you always wanted - Google Guava von Mite Mitreski
The core libraries you always wanted - Google GuavaThe core libraries you always wanted - Google Guava
The core libraries you always wanted - Google Guava
Mite Mitreski1K views
Programming JVM Bytecode von Joe Kutner
Programming JVM BytecodeProgramming JVM Bytecode
Programming JVM Bytecode
Joe Kutner1.4K views
Google guava - almost everything you need to know von Tomasz Dziurko
Google guava - almost everything you need to knowGoogle guava - almost everything you need to know
Google guava - almost everything you need to know
Tomasz Dziurko31.6K views
JDD 2016 - Grzegorz Piwowarek - Davaslang - Functional Java Done Right von PROIDEA
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
PROIDEA73 views
Javascript Testing with Jasmine 101 von Roy Yu
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101
Roy Yu1.6K views

Destacado

Home- (office) ? von
Home- (office) ?Home- (office) ?
Home- (office) ?Matthias Luebken
15.5K views25 Folien
JAX 2013: Modern Architectures with Spring and JavaScript von
JAX 2013: Modern Architectures with Spring and JavaScriptJAX 2013: Modern Architectures with Spring and JavaScript
JAX 2013: Modern Architectures with Spring and JavaScriptmartinlippert
18.5K views31 Folien
JAX 2013: Introducing Eclipse Orion von
JAX 2013: Introducing Eclipse OrionJAX 2013: Introducing Eclipse Orion
JAX 2013: Introducing Eclipse Orionmartinlippert
16.1K views18 Folien
Jax2013 PaaS-Parade - Part 1: Cloud Foundry von
Jax2013 PaaS-Parade - Part 1: Cloud FoundryJax2013 PaaS-Parade - Part 1: Cloud Foundry
Jax2013 PaaS-Parade - Part 1: Cloud Foundrymartinlippert
15.3K views10 Folien
Modern Architectures with Spring and JavaScript von
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptmartinlippert
16.4K views31 Folien
Scripted - Embracing Eclipse Orion von
Scripted - Embracing Eclipse OrionScripted - Embracing Eclipse Orion
Scripted - Embracing Eclipse Orionmartinlippert
15.6K views36 Folien

Destacado(10)

JAX 2013: Modern Architectures with Spring and JavaScript von martinlippert
JAX 2013: Modern Architectures with Spring and JavaScriptJAX 2013: Modern Architectures with Spring and JavaScript
JAX 2013: Modern Architectures with Spring and JavaScript
martinlippert18.5K views
JAX 2013: Introducing Eclipse Orion von martinlippert
JAX 2013: Introducing Eclipse OrionJAX 2013: Introducing Eclipse Orion
JAX 2013: Introducing Eclipse Orion
martinlippert16.1K views
Jax2013 PaaS-Parade - Part 1: Cloud Foundry von martinlippert
Jax2013 PaaS-Parade - Part 1: Cloud FoundryJax2013 PaaS-Parade - Part 1: Cloud Foundry
Jax2013 PaaS-Parade - Part 1: Cloud Foundry
martinlippert15.3K views
Modern Architectures with Spring and JavaScript von martinlippert
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScript
martinlippert16.4K views
Scripted - Embracing Eclipse Orion von martinlippert
Scripted - Embracing Eclipse OrionScripted - Embracing Eclipse Orion
Scripted - Embracing Eclipse Orion
martinlippert15.6K views
Spring Tooling: What's new and what's coming von martinlippert
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
martinlippert15.1K views
WJAX 2013: Java8-Tooling in Eclipse von martinlippert
WJAX 2013: Java8-Tooling in EclipseWJAX 2013: Java8-Tooling in Eclipse
WJAX 2013: Java8-Tooling in Eclipse
martinlippert15.1K views
EclipseCon-Europe 2013: Making the Eclipse IDE fun again von martinlippert
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
martinlippert15.9K views
WJAX 2013: Die PaaS-Parade - Teil 2 - Cloud Foundry von martinlippert
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
martinlippert15K views

Similar a EclipseCon-Europe 2013: Optimizing performance - how to make your Eclipse-based tools run fasterEce2013 optimizing performance

Developing Useful APIs von
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIsDmitry Buzdin
1K views64 Folien
Why Spring <3 Kotlin von
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 KotlinVMware Tanzu
1.4K views75 Folien
Test-driven development for TYPO3 (T3DD11) von
Test-driven development for TYPO3 (T3DD11)Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)oliverklee
938 views99 Folien
Sharepoint Saturday India Online best practice for developing share point sol... von
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
1.4K views33 Folien
Refactoring In Tdd The Missing Part von
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartGabriele Lana
7.9K views97 Folien
Twig tips and tricks von
Twig tips and tricksTwig tips and tricks
Twig tips and tricksJavier Eguiluz
199.3K views185 Folien

Similar a EclipseCon-Europe 2013: Optimizing performance - how to make your Eclipse-based tools run fasterEce2013 optimizing performance(20)

Why Spring <3 Kotlin von VMware Tanzu
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 Kotlin
VMware Tanzu1.4K views
Test-driven development for TYPO3 (T3DD11) von oliverklee
Test-driven development for TYPO3 (T3DD11)Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)
oliverklee938 views
Sharepoint Saturday India Online best practice for developing share point sol... von Shakir Majeed Khan
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 Khan1.4K views
Refactoring In Tdd The Missing Part von Gabriele Lana
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
Gabriele Lana7.9K views
Test-driven Development for TYPO3 von oliverklee
Test-driven Development for TYPO3Test-driven Development for TYPO3
Test-driven Development for TYPO3
oliverklee7.6K views
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine von Chris Adamson
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
Chris Adamson858 views
Боремся с NPE вместе с Kotlin, Павел Шацких СберТех von Сбертех | SberTech
Боремся с NPE вместе с Kotlin, Павел Шацких СберТехБоремся с NPE вместе с Kotlin, Павел Шацких СберТех
Боремся с NPE вместе с Kotlin, Павел Шацких СберТех
Functor, Apply, Applicative And Monad von Oliver Daff
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
Oliver Daff2.5K views
Asynchronous Programming at Netflix von C4Media
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at Netflix
C4Media2.9K views
Lists and scrollbars von myrajendra
Lists and scrollbarsLists and scrollbars
Lists and scrollbars
myrajendra1K views
Firebase & SwiftUI Workshop von Peter Friese
Firebase & SwiftUI WorkshopFirebase & SwiftUI Workshop
Firebase & SwiftUI Workshop
Peter Friese159 views
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう von Unity Technologies Japan K.K.
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
JavaOne 2013: Java 8 - The Good Parts von Konrad Malawski
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
Konrad Malawski40.3K views

Más de martinlippert

PaaS Parade - Cloud Foundry von
PaaS Parade - Cloud FoundryPaaS Parade - Cloud Foundry
PaaS Parade - Cloud Foundrymartinlippert
919 views10 Folien
Browser and Cloud - The Future of IDEs? von
Browser and Cloud - The Future of IDEs?Browser and Cloud - The Future of IDEs?
Browser and Cloud - The Future of IDEs?martinlippert
793 views29 Folien
Modern Architectures with Spring and JavaScript von
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptmartinlippert
11.9K views34 Folien
What's new with tooling for Spring, Grails, and the Cloud von
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
1.2K views38 Folien
Tooling for the JavaScript Era von
Tooling for the JavaScript EraTooling for the JavaScript Era
Tooling for the JavaScript Eramartinlippert
619 views42 Folien
Embracing Eclipse Orion von
Embracing Eclipse OrionEmbracing Eclipse Orion
Embracing Eclipse Orionmartinlippert
985 views30 Folien

Más de martinlippert(12)

PaaS Parade - Cloud Foundry von martinlippert
PaaS Parade - Cloud FoundryPaaS Parade - Cloud Foundry
PaaS Parade - Cloud Foundry
martinlippert919 views
Browser and Cloud - The Future of IDEs? von martinlippert
Browser and Cloud - The Future of IDEs?Browser and Cloud - The Future of IDEs?
Browser and Cloud - The Future of IDEs?
martinlippert793 views
Modern Architectures with Spring and JavaScript von martinlippert
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScript
martinlippert11.9K views
What's new with tooling for Spring, Grails, and the Cloud von martinlippert
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
martinlippert1.2K views
Tooling for the JavaScript Era von martinlippert
Tooling for the JavaScript EraTooling for the JavaScript Era
Tooling for the JavaScript Era
martinlippert619 views
Why SOLID matters - even for JavaScript von martinlippert
Why SOLID matters - even for JavaScriptWhy SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScript
martinlippert6.1K views
JAX 2012: Moderne Architektur mit Spring und JavaScript von martinlippert
JAX 2012: Moderne Architektur mit Spring und JavaScriptJAX 2012: Moderne Architektur mit Spring und JavaScript
JAX 2012: Moderne Architektur mit Spring und JavaScript
martinlippert2.2K views
JAX 2012: Pimp Your IDE Productivity von martinlippert
JAX 2012: Pimp Your IDE ProductivityJAX 2012: Pimp Your IDE Productivity
JAX 2012: Pimp Your IDE Productivity
martinlippert491 views
WaveMaker - Spring Roo - SpringSource Tool Suite - Choosing the right tool fo... von martinlippert
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...
martinlippert1.4K views
Spring Tooling Update - New & Noteworty (at SpringOne 2011) von 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)
martinlippert525 views
Classloading and Type Visibility in OSGi von martinlippert
Classloading and Type Visibility in OSGiClassloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGi
martinlippert6.9K views

Último

Generative AI: Shifting the AI Landscape von
Generative AI: Shifting the AI LandscapeGenerative AI: Shifting the AI Landscape
Generative AI: Shifting the AI LandscapeDeakin University
78 views55 Folien
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell von
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M SnellFwdays
14 views30 Folien
Deep Tech and the Amplified Organisation: Core Concepts von
Deep Tech and the Amplified Organisation: Core ConceptsDeep Tech and the Amplified Organisation: Core Concepts
Deep Tech and the Amplified Organisation: Core ConceptsHolonomics
17 views21 Folien
Optimizing Communication to Optimize Human Behavior - LCBM von
Optimizing Communication to Optimize Human Behavior - LCBMOptimizing Communication to Optimize Human Behavior - LCBM
Optimizing Communication to Optimize Human Behavior - LCBMYaman Kumar
39 views49 Folien
The Power of Generative AI in Accelerating No Code Adoption.pdf von
The Power of Generative AI in Accelerating No Code Adoption.pdfThe Power of Generative AI in Accelerating No Code Adoption.pdf
The Power of Generative AI in Accelerating No Code Adoption.pdfSaeed Al Dhaheri
44 views18 Folien
Measuring User on the web with the core web vitals - by @theafolayan.pptx von
Measuring User on the web with the core web vitals - by @theafolayan.pptxMeasuring User on the web with the core web vitals - by @theafolayan.pptx
Measuring User on the web with the core web vitals - by @theafolayan.pptxOluwaseun Raphael Afolayan
14 views13 Folien

Último(20)

"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell von Fwdays
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
Fwdays14 views
Deep Tech and the Amplified Organisation: Core Concepts von Holonomics
Deep Tech and the Amplified Organisation: Core ConceptsDeep Tech and the Amplified Organisation: Core Concepts
Deep Tech and the Amplified Organisation: Core Concepts
Holonomics17 views
Optimizing Communication to Optimize Human Behavior - LCBM von Yaman Kumar
Optimizing Communication to Optimize Human Behavior - LCBMOptimizing Communication to Optimize Human Behavior - LCBM
Optimizing Communication to Optimize Human Behavior - LCBM
Yaman Kumar39 views
The Power of Generative AI in Accelerating No Code Adoption.pdf von Saeed Al Dhaheri
The Power of Generative AI in Accelerating No Code Adoption.pdfThe Power of Generative AI in Accelerating No Code Adoption.pdf
The Power of Generative AI in Accelerating No Code Adoption.pdf
Saeed Al Dhaheri44 views
Transcript: Redefining the book supply chain: A glimpse into the future - Tec... von BookNet Canada
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
BookNet Canada43 views
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 von BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada46 views
"Running students' code in isolation. The hard way", Yurii Holiuk von Fwdays
"Running students' code in isolation. The hard way", Yurii Holiuk "Running students' code in isolation. The hard way", Yurii Holiuk
"Running students' code in isolation. The hard way", Yurii Holiuk
Fwdays38 views
GDSC GLAU Info Session.pptx von gauriverrma4
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptx
gauriverrma415 views
Business Analyst Series 2023 - Week 4 Session 8 von DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10180 views
Discover Aura Workshop (12.5.23).pdf von Neo4j
Discover Aura Workshop (12.5.23).pdfDiscover Aura Workshop (12.5.23).pdf
Discover Aura Workshop (12.5.23).pdf
Neo4j20 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... von ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue209 views
The Role of Patterns in the Era of Large Language Models von Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li104 views
Innovation & Entrepreneurship strategies in Dairy Industry von PervaizDar1
Innovation & Entrepreneurship strategies in Dairy IndustryInnovation & Entrepreneurship strategies in Dairy Industry
Innovation & Entrepreneurship strategies in Dairy Industry
PervaizDar139 views
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De... von Moses Kemibaro
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Moses Kemibaro38 views

EclipseCon-Europe 2013: Optimizing performance - how to make your Eclipse-based tools run fasterEce2013 optimizing performance

  • 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