1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-19 00:53:46 -05:00

Speed up realpath() with dynamically loaded C extension

On systems that support both C compiling and dynamic loading, we can
speed up `realpath()` (where most time in rbenv is spent) by replacing
it with a dynamically loaded bash builtin.

When `make -C src` is called in the project's root,
`libexec/rbenv-realpath.dylib` will be created. If it exists, rbenv will
attempt to load it as a builtin command. If it fails, execution will
fall back to the old `realpath()` shell function.
This commit is contained in:
Mislav Marohnić
2014-01-03 21:25:18 +01:00
parent 13a474c4e9
commit 16c7eb4135
5 changed files with 89 additions and 1 deletions

10
src/Makefile Normal file
View File

@@ -0,0 +1,10 @@
SHOBJ_LDFLAGS = -dynamiclib -current_version 1.0
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
../libexec/rbenv-realpath.dylib: realpath.o
$(CC) $(CFLAGS) $(SHOBJ_LDFLAGS) -o $@ realpath.o
clean:
rm -f *.o ../libexec/*.dylib