Archive

Archive for January, 2009

Faster Java – Strings

January 29th, 2009

If you’re building a long String in Java, don’t stick String objects together using ‘+’, for example:

String str = "Hello";
str = str + world;
str = str + "!";

Why not?

It’s really slow when you do it a lot!

What should you do instead?

Use the append(String) method in StringBuffer (Java 1.4.2 on), or StringBuilder (Java 5 on). StringBuilder is slightly faster than StringBuffer, but is not thread safe. Both are much faster than concatenating String objects – by orders of magnitude. For example:

StringBuffer str = new StringBuffer("Hello");
str.append(world);
str.append("!");

Read more…

Paul Brabban Beginners, Development, Java , , , , , , , ,

Semantic Web@Geekup Sheffield

January 12th, 2009

For anyone curious about this Semantic Web thing, you could check out Ian Ibbo’s introductory slideshow…



It’s the first part of series he’s doing at the Sheffield Geekups over the next few months, so there’s more if your appetite is whetted. There were rave reviews from the introductory talk…Next one will be at Sheffield’s Showroom cinema on the first Wednesday of February.Cheers!

Paul Brabban Development, Semantic Web, geekup , , ,

Automata Step-By-Step

January 11th, 2009