ext3 File System Performance Issue

Dear all,

I am writing a program which generates lots of temp files,
and need to remove the unneeded ones (to save disk space)
during execution. Currently I put them into the /tmp directory,
but I found the performance very slow, especially during the
file remove phase when the number of files generated is large.
(Each file size is small, at a maximum of 16KB, though.)

Is it true that when a single file is removed in ext3 file system,
the time needed is proportional to the number of files inside
the directory? Or is there a "threshold" number of files that
can be stored in a ext3 file system directory, and if this number
is exceeded, performance drops drastically? If so, what is this
threshold number is ext3?

Many thanks in advance.

Best Regards,
LaBird (Benny).
[Remove all numbers for the actual email address].