A letter from Tom in regards to performance

I came up with a decent way to instrument the time TM4JScript takes to do various things. I tried it out on my bookmarks app. This has gotten slow to load as my collection of bookmarks has grown. By now the topic map in its javascript serialization is about 2.6 MB. In Moz/Firebird, loading this thing takes about 17 MB of memory. That's not bad, when you consider that if it were an XML file, a standard DOM would probably have been 25 - 50 MB.

IE consumed 71 MB for the same data!

The app creates and populates the topic map, and them goes through a series of enrichment steps in which it creates new topics, associations, and an index. The map when enriched has 2939 topics and 1236 associations. The timing data came out like this (times in seconds):

Operation Moz IE6


Build topic map 23.6 13.2

Create compound 1.5 30.5


Create name index 0.04 1.0

Analyze special terms 0.5 8.1

Create page 1.1 23.5

These are pretty amazing differences!

The time to create the original map seems to vary from about 20-30 seconds with Moz/Firebird on my machine.

Here is how I did the timing. I created a global object in the frameset to hold the data, and I gave it a method for returning a string showing all of its attribute/value pairs. I measured the time of various operations using

new Date().getTime() to get milliseconds at the begin and end, then assigned the delta time to an attribute of the object. After everything has been loaded, I can ask the object to display itself from any frame, and get the collected data. Here is the object;

var stats = new Object()

stats.showData = function(newline) {

var newline = newline || '\n'

var str = ''

for (var i in stats) {

if (i == 'showData') {continue}

str += i + ': ' + stats[i] + newline


return str


I can add data to the stats object from any of the frames loaded by the frameset, then display the results like this -


(Here, "Home" is a variable that points to the location of the parent code)

Regards, Tom