vs> [...] It shows that 82% of the time goes in file_name_1/1,
vs> which "Generates a flat file name from a deep list of atoms and
vs> characters (integers)".
Ville, I don't have a good reply (other than, yes, 82% of the app's user
time is probably being used there ... but eprof can't measure
system/in-kernel time well). But I do have a "yeah, me too!" message
for the OTP gang.
I've got an app that does a *lot* of file opening & closing.
1. Figure out what file a key is stored in.
2. Open that file.
3. Seek to some position within the file
4. Read some bytes.
5. Close the file
6. Lather, rinse, repeat...
... across tens of thousands of files in the local file system
(representing gazillions of smaller objects). After I discovered the
cost of erlang:md5/1 vs. crypto:md5/1 (see message to the list a little
while ago), the 2nd biggest time sucker was the same function that Ville
is complaining about: file:file_name_1/1.
How frequent is it to use a deep I/O list as a file name? (Perhaps I've
been in C land for too long to think that using a deep I/O list like
that is actually a good idea?) Doesn't an argument like that get
automatically flattened when passed to the efile_drv driver? If yes,
why bother flattening on the Erlang side?
-Scott
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Unfortunately, for historical reasons, filenames are allowed to
contain atoms and atoms are not allowed in I/O lists. At one time
in OTP's history, we wanted to disallowed atoms in filenames, but
it turned out that many applications used atoms in filenames.
/Bjorn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
Unless you specifically included the file_server_2 process in the set
of processes
to profile, you are only profiling the time spent in your own
processes and not code
that is executed in other processes. (And since I don't see no calls
from the file_server or prim_file
module in the output from eprof, I assume that you did not include the
file_server_2 process.)