libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

README_bt.md (1926B)


      1 TODO what are bt, vbt, dbt?
      2 
      3 # Libsheepy bt (bytes type) performance
      4 
      5 ```
      6 - times are in ms
      7                    bt    sds   diff
      8 trim               25    105     4x
      9 slice/sdsrange     11     77     7x
     10 push/sdscat       165    186  1.13x
     11 split (dbt)        25    138  5.52x (with vbt: 49ms)
     12 short split (vbt) 191    520  2.72x (with static array: 14ms, with dbt: 240ms)
     13 
     14 - allocation count
     15                      bt      sds
     16 trim                  1  1000000
     17 slice/sdsrange        1  1000000
     18 push/sdscat          15       16
     19 split (dbt)         329    10000  (with vbt: 10000)
     20 short split (dbt) 20001    70000  (with static array: 1, with vbt: 50000)
     21 
     22 - heap usage in kb
     23                      bt      sds   diff
     24 trim                  4     1000
     25 slice/sdsrange        4     1000
     26 push/sdscat         139      128
     27 split (dbt)         360      370  (with vbt: 940)
     28 short split (vbt)  4000     1474  (with static array: 4, with dbt: 10000)
     29 ```
     30 
     31 - The trim test calls the trim function 1 million times.
     32 - The slice test calls the slice function 1 million times.
     33 - The push test appends the string "%d ",i with int i going from 0 to 1 million
     34 - The split test splits the result from the push test and generates a list with 1 million tokens
     35 - The short split test splits a string of 5 tokens 1 million times
     36 
     37 libsheepy trim doesn't call memmove whereas sdstrim destroys the input by calling memmove.
     38 libsheepy slice doesn't call memmove whereas sdsrange destroys the input by calling memmove.
     39 
     40 sdscat has a good performance because of allocation mechanism.
     41 
     42 libsheepy split (with dbt: dynamic segmented bt array) has a good performance because only malloc is called when building the list whereas sdssplitlen calls realloc.
     43 
     44 The short split test is dominated by malloc and free and the data structure requiring the less malloc/free is vbt.
     45 
     46 libsheepy bt is faster than sds since there are less memory allocations and less calls to memmove.