diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-08-14 21:22:03 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-08-14 21:22:03 +0000 |
commit | f01674e99a467e9eb99323130a1e1add4c57eda2 (patch) | |
tree | 50bfa258b1c5761b2fbbac86d945d981669f27d4 /src/tests | |
parent | 42f4f849c683bc30404727f4dccc9d3cfd030adf (diff) | |
download | libbu++-f01674e99a467e9eb99323130a1e1add4c57eda2.tar.gz libbu++-f01674e99a467e9eb99323130a1e1add4c57eda2.tar.bz2 libbu++-f01674e99a467e9eb99323130a1e1add4c57eda2.tar.xz libbu++-f01674e99a467e9eb99323130a1e1add4c57eda2.zip |
Massive freaking changes!!!
Bu:;SharedCore actually is in and works, it's well tested and there are no
known memory leaks or violations as of now. It's been applied to Bu::List and
Bu::FBasicString so far. This means that everything using Bu::List and
Bu::FBasicString will be much, much faster and use considerably less memory.
I still have plans to apply this to Hash and maybe a couple of other core
classes.
Diffstat (limited to '')
-rw-r--r-- | src/tests/sharedcore.cpp | 24 | ||||
-rw-r--r-- | src/tests/speed.cpp | 5 |
2 files changed, 16 insertions, 13 deletions
diff --git a/src/tests/sharedcore.cpp b/src/tests/sharedcore.cpp index bdfde4c..9f65ac5 100644 --- a/src/tests/sharedcore.cpp +++ b/src/tests/sharedcore.cpp | |||
@@ -12,42 +12,42 @@ class Shint : public Bu::SharedCore<struct ShintCore> | |||
12 | public: | 12 | public: |
13 | Shint() | 13 | Shint() |
14 | { | 14 | { |
15 | data->val = 0; | 15 | core->val = 0; |
16 | } | 16 | } |
17 | 17 | ||
18 | Shint( int val ) | 18 | Shint( int val ) |
19 | { | 19 | { |
20 | data->val = val; | 20 | core->val = val; |
21 | } | 21 | } |
22 | 22 | ||
23 | int getVal() | 23 | int getVal() const |
24 | { | 24 | { |
25 | return data->val; | 25 | return core->val; |
26 | } | 26 | } |
27 | 27 | ||
28 | void setValBad( int val ) | 28 | void setValBad( int val ) |
29 | { | 29 | { |
30 | data->val = val; | 30 | core->val = val; |
31 | } | 31 | } |
32 | 32 | ||
33 | void setVal( int val ) | 33 | void setVal( int val ) |
34 | { | 34 | { |
35 | _hardCopy(); | 35 | _hardCopy(); |
36 | data->val = val; | 36 | core->val = val; |
37 | } | 37 | } |
38 | 38 | ||
39 | bool operator==( const Shint &rhs ) | 39 | bool operator==( const Shint &rhs ) |
40 | { | 40 | { |
41 | if( data == rhs.data ) | 41 | if( core == rhs.core ) |
42 | { | 42 | { |
43 | sio << "Same pointer (" << Fmt::ptr() << data << ")" << sio.nl; | 43 | sio << "Same pointer (" << Fmt::ptr() << core << ")" << sio.nl; |
44 | return true; | 44 | return true; |
45 | } | 45 | } |
46 | if( data->val == rhs.data->val ) | 46 | if( core->val == rhs.core->val ) |
47 | { | 47 | { |
48 | sio << "Same value " << data->val << " (" | 48 | sio << "Same value " << core->val << " (" |
49 | << Fmt::ptr() << data << " vs " | 49 | << Fmt::ptr() << core << " vs " |
50 | << Fmt::ptr() << rhs.data << ")" | 50 | << Fmt::ptr() << rhs.core << ")" |
51 | << sio.nl; | 51 | << sio.nl; |
52 | return true; | 52 | return true; |
53 | } | 53 | } |
diff --git a/src/tests/speed.cpp b/src/tests/speed.cpp index b8924d7..5b26dd3 100644 --- a/src/tests/speed.cpp +++ b/src/tests/speed.cpp | |||
@@ -43,6 +43,9 @@ void fullTest( tst t ) | |||
43 | 43 | ||
44 | int main() | 44 | int main() |
45 | { | 45 | { |
46 | fullTest( tstCopy<Bu::FString>("This is a test string.") ); | 46 | Bu::FString str; |
47 | for( int j = 0; j < 500; j++ ) | ||
48 | str.append("Hey, this is a test string. It will be reapeated many, many times. How's that?"); | ||
49 | fullTest( tstCopy<Bu::FString>( str ) ); | ||
47 | } | 50 | } |
48 | 51 | ||