Skip to content

Commit

Permalink
Improve efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvasz committed Jan 2, 2012
1 parent 42cc52b commit 068cab8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TESTOBJS = obj/array_hash_test.o obj/hat_set_test.o
TESTEXE = bin/test

# make variables
OFLAGS = -O2
OFLAGS =
CXX = /opt/llvm/bin/clang++
CXXFLAGS = -Wall -c
LDFLAGS = -lboost_unit_test_framework-mt -lprofile_rt -L/opt/llvm/lib
Expand All @@ -18,7 +18,7 @@ COMPILE.cpp = $(CXX) $(CXXFLAGS)
all: main

main: $(OBJS)
$(CXX) $(OFLAGS) $(OBJS) -o $(EXE)
$(CXX) $(OFLAGS) $(OBJS) -o $(EXE)

time: main
time bin/main < inputs/kjv
Expand Down
4 changes: 1 addition & 3 deletions src/array_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -728,9 +728,7 @@ class array_hash<std::string>
void _init()
{
_data = new char *[_traits.slot_count];
for (int i = 0; i < _traits.slot_count; ++i) {
_data[i] = NULL;
}
memset(_data, NULL, _traits.slot_count * sizeof(char*));
_size = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hat_trie.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class hat_trie_traits {

public:
hat_trie_traits() {
burst_threshold = 2;
burst_threshold = 16384;
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/hat_trie_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ class hat_trie_node : public hat_trie_node_base {
public:
/// Default constructor.
hat_trie_node(char ch = '\0') : _node_base(ch) {
for (int i = 0; i < HT_ALPHABET_SIZE; ++i) {
_children[i] = NULL;
}
memset(_children, NULL, sizeof(_node_base *) * HT_ALPHABET_SIZE);
set_word(false);
}

Expand Down
2 changes: 1 addition & 1 deletion test/hat_set_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct HatTrieData
HatTrieData()
{
ifstream file;
file.open("inputs/kjv");
file.open("test/inputs/kjv");
if (!file) {
throw "file not opened";
}
Expand Down

0 comments on commit 068cab8

Please sign in to comment.