Artur Biesiadowski <[EMAIL PROTECTED]> writes:

> I still think that major penalty is creation of CharAttr for every
> request. It is really overhead, as it is never reused. I think that if
> all methods would access table directly and lookup only what is needed,
> we could match JDK speed (be not more than 2x slower than them).

A simple change was made to cache the last used CharAttr, and use it
if appropriate.  This assumes that once you've asked for one bit of
information on a character, you'll probably ask for more information
on that same character.  We're less than 2x slower now.

I'll see about removing CharAttr sometime in the future, to see if I
can speed things up a bit more.

Some timings...

All tests were run under Blackdown's JDK 1.1.7 w/ native thread
support for GNU/Linux.

Classpath after Aaron's changes:
bash-2.01$ time java CharacterTest
Reading unicode database...done
DONE: 1713/3579048 failures/tests

real    2m44.286s
user    0m0.260s
sys     0m0.190s

Classpath after caching the last read charAttr.
Reading unicode database...done
DONE: 1713/3579048 failures/tests

real    1m13.673s
user    0m0.270s
sys     0m0.170s

Sun's java.lang.Character.
bash-2.01$ time java CharacterTest
Reading unicode database...done
DONE: 728/3578944 failures/tests

real    0m41.337s
user    0m0.260s
sys     0m0.190s

-- 
Paul Fisher * [EMAIL PROTECTED]

Reply via email to