optimize speed by gprof

This commit is contained in:
pikastech 2022-10-06 13:25:45 +08:00
parent ed6d17ab97
commit c86fbdff41
4 changed files with 6 additions and 17 deletions

View File

@ -7,10 +7,10 @@ ENDIF(PIKA_CONFIG_ENABLE)
project(pikascript VERSION 0.1.0)
# SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
# SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pg")
# SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -pg")
# SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -pg")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
# SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")

View File

@ -1 +1 @@
gprof build/test/pikascript_test gmon.out > report.txt
gprof Release/benchmark/pikascript_benchmark gmon.out > report.txt

View File

@ -102,11 +102,6 @@ static Arg* arg_set(Arg* self,
void arg_init_stack(Arg* self, uint8_t* buffer, uint32_t size) {
self->_.buffer = buffer;
self->size = size;
self->type = ARG_TYPE_UNDEF;
self->name_hash = 0;
self->flag = 0;
arg_setSerialized(self, PIKA_FALSE);
arg_setIsKeyword(self, PIKA_FALSE);
}
uint32_t arg_totleSize(Arg* self) {
@ -313,12 +308,6 @@ char* arg_getStr(Arg* self) {
return (char*)arg_getContent(self);
}
Hash arg_getNameHash(Arg* self) {
if (NULL == self) {
return 999999;
}
return self->name_hash;
}
ArgType arg_getType(Arg* self) {
if (NULL == self) {

View File

@ -84,7 +84,7 @@ Arg* arg_setName(Arg* self, char* name);
Arg* arg_setContent(Arg* self, uint8_t* content, uint32_t size);
Arg* arg_newContent(Arg* self, uint32_t size);
Arg* arg_setType(Arg* self, ArgType type);
Hash arg_getNameHash(Arg* self);
#define arg_getNameHash(__self) ((__self)->name_hash)
ArgType arg_getType(Arg* self);
uint32_t arg_getContentSize(Arg* self);
Hash hash_time33(char* str);