forked from bkaradzic/GENie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace path.getabsolute and path.getrelative with C versions
These functions were showing up as hotspots in benchmarks. The new C versions perform as much as 100x faster depending on the complexity of the paths being handled.
- Loading branch information
Brett Vickers
committed
Feb 6, 2017
1 parent
8c099a5
commit 370a54d
Showing
12 changed files
with
371 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* \file path_getabsolute.c | ||
* \brief Calculate the absolute path from a relative path | ||
*/ | ||
|
||
#include "premake.h" | ||
|
||
int path_getabsolute(lua_State *L) | ||
{ | ||
const char *path = luaL_checkstring(L, -1); | ||
char buffer[PATH_BUFSIZE]; | ||
get_absolute_path(path, buffer, PATH_BUFSIZE); | ||
lua_pushstring(L, buffer); | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* \file path_getrelative.c | ||
* \brief Calculate the relative path from src to dest | ||
*/ | ||
|
||
#include "premake.h" | ||
|
||
int path_getrelative(lua_State *L) | ||
{ | ||
const char *src = luaL_checkstring(L, -2); | ||
const char *dst = luaL_checkstring(L, -1); | ||
char buffer[PATH_BUFSIZE]; | ||
get_relative_path(src, dst, buffer, PATH_BUFSIZE); | ||
lua_pushstring(L, buffer); | ||
return 1; | ||
} |
Oops, something went wrong.