On Tue, 26 Feb 2002, Christian Molstrom wrote:
> ...but I wonder what performance difference there might be
> between (a) pulling the data straight from xml (probably via SAX) and
> (b) returning data from a getter method in an object.
Massive. In the second case, you've got the data in an object in
memory, and you're just returning a base type or an object reference.
In the second you're doing parsing of strings (always expensive),
perhaps file I/O, and who knows what else. That's really something
you want to do only once, if you can manage it. In this case we're
dealing with quite a small amount of data, so it's not a big deal.
Even if it got as large as 2K/phone and we had 500 phones, that's
still only a megabyte of data.
> You need to add a step for parsing the incoming user agent for lookup
> and figuring out just what object to instantiate.
Well, the idea is that the object is already instantiated; you just
need to determine to which one to return a reference. But that's
a minor nit.
You're right that dealing with user-agent -> object lookup is going
to be a bit of work. But hey, start with something basic, and you
can refine it as you discover problems. As your library of test
cases grows, your code will get better and better at this.
cjs
--
Curt Sampson <cjs_at_cynic.net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC
Received on Tue Feb 26 18:25:13 2002