• Home
  • RSS Feed
  • Log in

EJAPP Top 10 countdown: #4 – Badly performing libraries
Posted by Vincent Partington in the late evening: April 16th, 2007

After skipping the easter weekend to go snowboarding in Chamonix, I'll continue the EJAPP Top 10 countdown with number 4.

Badly performing libraries are a problem that occurs more often than one would expect. This issue is somewhat similar to the incorrect usage of Java EE in that not enough care is taken in selecting and using a certain technology. Some development teams will happily pile JAR after JAR into their WEB-INF/lib directory or into their POM file, :

  • without checking whether that library is really needed (and does not overlap with functionality already offered by other libraries used),
  • without checking whether that library can offer good performance or whether a better performing alternative is available,
  • without reading the documentation to see how it should properly be used, and
  • without defining how the library is going to be used within the application

Examples here are:

  • BEA's implementation of the STaX API that is more than two times slower than some of its competitors.
  • java.net.URLEncoder that is outperformed up to 90 times (!) by org.apache.commons.codec.net.URLCodec in multi threaded applications (= all web applications).
  • Earlier versions of JAMon had bad performance due to repeated allocations of DateFormat and NumberFormat. Ironically, JAMon is a tool to monitor the performance of your application. ;-)

Even worse, some development teams will write their own frameworks and libraries where existing ones already exist that offer (nearly) the same functionality and (usually) better performance. Apart from the initial inferior performance, these libraries and frameworks do not evolve as rapidly as existing (free) libraries in terms of performance (and functionality and security and ...). As Linus says: Many eyes make all bugs shallow. Unfortunately, I can't give any examples here as those frameworks are, by definition, proprietary.

In any case, to prevent these kinds of problems, follow these steps when some functionality is needed :

  1. Check libraries already used in the project for the functionality.
  2. Check existing (free) libraries for the functionality.
  3. Only when an existing library cannot be found, implement the functionality yourself. Consider releasing it as free software; the community will benefit and may even offer additional functionality, performance improvements, security fixes, etc.
  4. Verify that the selected library can offer the required performance.
  5. Read the documentation, newsgroups and forums about proper usage of the library.

And only then use an existing library or build your own.

  • Share/Bookmark

Filed under Java, Performance | 2 Comments »



2 Responses to “EJAPP Top 10 countdown: #4 – Badly performing libraries”



    Xebia Blog Says:
    Posted at: July 31, 2007 at 9:13 am

    [...] Discussed are numbers 4-Badly performing libraries. More information about number 4 can be found here. and for number 3-Incorrectly implemented concurrency see; here. [...]



    RuntimeException Says:
    Posted at: March 29, 2008 at 3:28 am

    Very true!

    One thing that developers take for granted in the standard Java libraries, which can contain many surprises in terms of performance. Date handling being a good example.

    Thanks for the tip on URLEncoder, I am off to write a test case :)



Leave a Reply

Click here to cancel reply.

Deployment automation for Java application running on Websphere, WebLogic and JBoss

Archives

  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009

Training

  • Tackling Top 10 JavaEE Performance Pitfalls
    13 & 14 May 2009

Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India

Categories

  • Java (282)
  • Agile (109)
  • General (50)
  • Testing (42)
  • Performance (42)
  • Hibernate (36)
  • Scrum (33)
  • Podcast (31)
  • Architecture (31)
  • Spring (28)
  • SOA (24)
  • Maven (22)
  • Project Management (22)
  • Middleware (23)
    • Deployment (14)
  • Flex (17)
  • JPA (17)
  • Eclipse (15)
  • Xebia Labs (15)
  • Quality Assurance (14)

Tag Cloud

    Xebia fitnesse Hibernate Semantic Web Java Scrum XML Performance qcon Maven JavaOne Seam Functional Programming Spring Introduction to Agile Closures Testing SOA Agile Awareness Workshop Ajax Agile IntelliJ Architecture Groovy Poppendieck Grails Scala esb product owner Lean