ldd on Darwin / OSX?

Posted on January 30, 2008 by ZDima.
Categories: OS X.
  1.  otool -L <executable>

Why my code is running slow on MAC 10.4

Posted on June 11, 2007 by ZDima.
Categories: OS X, UNIX Dev.

I had a complaint that performance of the program was degraded after machine was upgraded to 10.4.

After investigation it is appear that system call ‘getcwd‘ become very expensive call where internally it is iterates through the each parent directory and collect information to construct the path rather then remember the program’s current folder.

Since this system call was use to save the name of a working directory to return to it later, the solution was to replace it with system calls open+fchdir that will actually do the same work. This was recommended in man pages for getcwd (MAC):

These routines have traditionally been used by programs to save the name
of a working directory for the purpose of returning to it. A much faster
and less error-prone method of accomplishing this is to open the current
directory (’.') and use the fchdir(2) function to return.