Cedric BAIL
e713c62730
* eina_stringshare: We should use "unsigned char", because suncc think that char is signed.
...
SVN revision: 41697
2009-08-12 09:02:09 +00:00
Vincent Torri
9110d8d574
fix a bit the documentation, but there are still
...
a lot of doc to write...
SVN revision: 41164
2009-06-22 20:03:58 +00:00
Vincent Torri
33cfc873ec
Fix init error handling of array, benchmark, counter,main,
...
rectangle and stringshare modules. Patch by Andre Dieb, modified
by me (formatting and fix for the Windows code in eina_counter)
SVN revision: 40915
2009-06-06 04:22:21 +00:00
Gustavo Sverzut Barbieri
ebeabe3735
enable adding just part of a string.
...
this allows us to add stringshare from a larger buffer that cannot be
modified.
SVN revision: 40516
2009-05-06 04:11:01 +00:00
Vincent Torri
18258b5721
fix llvm report in eina_stringshare
...
SVN revision: 39707
2009-03-25 10:32:33 +00:00
Vincent Torri
8bee601e8d
fix warnings with vc++
...
SVN revision: 38744
2009-01-23 18:24:35 +00:00
Vincent Torri
c166854ae1
* minor formatting
...
* add some doc in eina_array
* in eina_main.c, include only the necessary headers
* fix some warnings (size_t <-> int)
SVN revision: 38740
2009-01-23 16:11:45 +00:00
Cedric BAIL
0dda30daf6
* eina/src/include/eina_array.h,
...
* eina/src/include/eina_f16p16.h,
* eina/src/include/eina_accessor.h,
* eina/src/include/eina_list.h,
* eina/src/include/eina_iterator.h,
* eina/src/lib/eina_rectangle.c,
* eina/src/lib/eina_list.c,
* eina/src/lib/eina_array.c,
* eina/src/lib/eina_hash.c,
* eina/src/lib/eina_module.c,
* eina/src/lib/eina_stringshare.c,
* eina/src/lib/eina_benchmark.c: Fix for windows compilation.
SVN revision: 38663
2009-01-20 15:56:48 +00:00
Gustavo Sverzut Barbieri
ab95d9183d
eina safety checks.
...
safety checks will report null pointers and other error conditions on
public api's and can be disabled by compile time check.
note that in order to have these checks working we need to make
EINA_ARG_NONNULL() void, otherwise GCC can remove these checks since
they're known to be false.
This commit also make two minor changes:
* list and hash accessors and iterators are created even for empty
entities. This is correct in my point of view since NULL should
indicate error. Having these in were an optimziation, but not
worth it, these are not the most common case and hitting this path
is not of much cost.
* unmarked some parameters as nonnull, mainly on list and inlist.
SVN revision: 38327
2008-12-26 18:31:14 +00:00
Gustavo Sverzut Barbieri
de8b6a7bbd
fix possible errors with pointer/offset calculation.
...
it works on gcc, but maybe it would break in other compilers, so make
it safe.
SVN revision: 38302
2008-12-23 20:05:44 +00:00
Gustavo Sverzut Barbieri
765b770f82
oops, eina_stringshare_strlen() should never account '\0'.
...
SVN revision: 38260
2008-12-21 06:45:09 +00:00
Vincent Torri
a00a2a3636
put static functions where they belong
...
SVN revision: 37552
2008-11-08 16:47:52 +00:00
Sebastian Dransfeld
4173b41de5
Add missing return value.
...
SVN revision: 37528
2008-11-07 06:50:45 +00:00
Gustavo Sverzut Barbieri
9e80a086f6
Add and use eina_stringshare_ref().
...
This is a faster "add", if we know we're using a shared string we know
the node without any need to search it, just increment reference and
exit.
SVN revision: 37458
2008-11-04 16:25:12 +00:00
Gustavo Sverzut Barbieri
c1d2134caf
Pack a hole when magic is in use.
...
SVN revision: 37324
2008-10-29 23:50:24 +00:00
Gustavo Sverzut Barbieri
a39edb7baa
Do not pad node on 64bits.
...
Instead of padding node we should always refer to offset of str[]
inside node, that way we save some bytes and work properly.
SVN revision: 37322
2008-10-29 23:33:24 +00:00
Gustavo Sverzut Barbieri
5e30ab4563
Remove unused attribute warnings.
...
SVN revision: 37307
2008-10-29 14:51:18 +00:00
Gustavo Sverzut Barbieri
f22f587bab
Fix stringshare on 64bits platforms.
...
sizeof(Eina_Stringshare_Node) is now 24 bytes on 64bits platforms, but
str[] was pointing to before that, to the 20th byte, causing out of
bounds access.
Adding the padding will cause str[] to use the correct position. It
wastes 4 more bytes, like pre-optimizations, but it's just on big
machines.
SVN revision: 37305
2008-10-29 14:18:29 +00:00
Carsten Haitzler
0e4dcecbc4
remove from list properly and don't segv!
...
SVN revision: 37290
2008-10-29 01:38:47 +00:00
Gustavo Sverzut Barbieri
71f9c5aab7
refactor eina_stringshare_del() to make it easier to read.
...
SVN revision: 37282
2008-10-28 18:12:10 +00:00
Gustavo Sverzut Barbieri
1119bfebc1
improve readability: avoid macros inside our code
...
mixing #ifdef'ed blocks inside code is bad, can lead to warnings if
some variables are not used and it's a pain to read.
instead, just define functions and always call them, choose their
implementation based on the ifdef macros. I opted to have 2
declarations, but one can go like other parts and #ifdef around the
function contents as well.
SVN revision: 37281
2008-10-28 17:47:59 +00:00
Gustavo Sverzut Barbieri
a5db129f56
Add missing magic check for existing node.
...
SVN revision: 37279
2008-10-28 17:16:42 +00:00
Gustavo Sverzut Barbieri
2569094023
Code refactor and cleanup of eina_stringshare_add().
...
Cases are now handled in separate, doing less useless steps and easier
to understand since 3 cases are now distinct.
SVN revision: 37278
2008-10-28 17:15:07 +00:00
Cedric BAIL
4592044c82
Fix a little typo.
...
SVN revision: 37274
2008-10-28 14:45:16 +00:00
Gustavo Sverzut Barbieri
96adb8e1f0
save a byte per stringshare node.
...
we don't need to use 'begin' flag (that takes a byte) just to see if
we're in the same memory block as the head, just do a pointer math.
SVN revision: 37270
2008-10-28 12:34:58 +00:00
Gustavo Sverzut Barbieri
0b1e2fa0dc
reduce the popuplation_group size.
...
we just have special case for up to 3 letters, everything else is
regular population.
SVN revision: 37269
2008-10-28 12:26:05 +00:00
Gustavo Sverzut Barbieri
3cd98b547a
stringshare_del optimization.
...
trade off safety by speed, we will always assume str was previously
shared, like evas_stringshare_del() did and we can know with zero-cost
the number of references and can avoid strlen() too.
When references drop to zero we still have to do the hash, access the
bucket and then lookup the Red-Black tree, then walk the list of
nodes, but avoiding so would use more memory, unacceptable at this
point.
SVN revision: 37268
2008-10-28 12:23:12 +00:00
Gustavo Sverzut Barbieri
8325ae6ba3
Save 4 bytes per big string shared.
...
SVN revision: 37258
2008-10-28 00:42:35 +00:00
Gustavo Sverzut Barbieri
24ee564949
Cheap way to get strlen of a shared string.
...
it's not safe, but it's faster and can help for large strings, maximum
cost is 4 comparisons plus one pointer access.
SVN revision: 37257
2008-10-28 00:31:09 +00:00
Gustavo Sverzut Barbieri
16aed2623d
define function as void as in prototype.
...
SVN revision: 37256
2008-10-28 00:18:31 +00:00
Gustavo Sverzut Barbieri
d4ac927395
dump show percentages.
...
not that useful, but I like it.
SVN revision: 37253
2008-10-27 20:35:28 +00:00
Gustavo Sverzut Barbieri
db296d3d3c
better optimize small stringshare comparison
...
SVN revision: 37251
2008-10-27 20:16:52 +00:00
Gustavo Sverzut Barbieri
c311dd99a2
stringshare: special case for small (2-3 letters).
...
This should reduce overhead and give a bit speedup as well, let's test
with e17 real data and see how it goes.
SVN revision: 37250
2008-10-27 19:26:14 +00:00
Cedric BAIL
45273db267
Correctly put condition around the code.
...
SVN revision: 37244
2008-10-27 14:05:09 +00:00
Cedric BAIL
d46f7e583e
* Optimize case for string length == 0 and 1.
...
* Add more debug information when using --enable-stringshare-usage.
SVN revision: 37239
2008-10-27 13:23:52 +00:00
Sebastian Dransfeld
b6ddfb54cf
Mark unused parameter with __UNUSED__
...
SVN revision: 37214
2008-10-27 09:49:13 +00:00
Carsten Haitzler
089b8ac181
add a stringshare dumper so we can examine what's in there and improve usage.
...
SVN revision: 37186
2008-10-27 00:36:22 +00:00
Vincent Torri
84dcc24d09
Fix compilation and warnings on Windows:
...
* include Evil.h for getenv on mingw32ce
* include config.h in benchmark.c so that EAPI is correctly defined
* minor fixes in configure.ac
SVN revision: 36729
2008-10-16 21:31:51 +00:00
Cedric BAIL
d905ee9bda
Add option to report stringshare usage (E17 use around 10000 differents strings).
...
SVN revision: 36658
2008-10-14 15:32:57 +00:00
Cedric BAIL
ed012620d1
Fix stringshare bug with same length.
...
SVN revision: 36657
2008-10-14 15:31:45 +00:00
Cedric BAIL
0bc2413113
Fix prev pointer during stringshare_del.
...
SVN revision: 36319
2008-09-29 17:07:50 +00:00
Cedric BAIL
040e5573d9
Patch from Arnaud de Turckheim "quarium" <quarium@gmail.com>.
...
Use magic inside stringshare without slowdown of benchmark.
Fix magic when not in DEBUG mode.
SVN revision: 36246
2008-09-25 09:02:41 +00:00
Cedric BAIL
550ebc9ab1
Add hash and rbtree delete callback, cleanup the code and improve performance (hash as a new internal structure).
...
We still need a hash function for removing a node from the hash and destroying it at the same time.
SVN revision: 36222
2008-09-24 17:14:29 +00:00
Cedric BAIL
b00e9e5c64
Use rbtree helper.
...
SVN revision: 36208
2008-09-24 12:57:26 +00:00
Cedric BAIL
8acad8a50e
Add rbtree destructor without tree reorder and use it.
...
SVN revision: 36188
2008-09-23 16:07:48 +00:00
Cedric BAIL
f656fabac1
Make magical mask easily testable.
...
SVN revision: 36171
2008-09-22 14:45:57 +00:00
Cedric BAIL
d0871d7d7d
Eina stringshare now beat evas and ecore with this last change.
...
Benchmarking with enlightenment real data (25000 string add, 20 000 del) :
- eina: 4151399
- evas: 4286973
- ecore: 7753004
SVN revision: 36166
2008-09-22 13:11:08 +00:00
Cedric BAIL
d3e0b59223
Reduce number of malloc/free by automatically created one stringshare
...
per tree node.
SVN revision: 36165
2008-09-22 13:06:29 +00:00
Cedric BAIL
1726e80939
Use define.
...
SVN revision: 36159
2008-09-22 10:08:44 +00:00
Vincent Torri
f50feadeae
* add benchmark and file documentation
...
* reorganize a bit more. it's not finished
* fix spellingg and formatting
* gnuplot file names generated by our bechmarks tests have an
absolute time description and not H:M:S description, as this
breaks the check out of the repo on Windows.
SVN revision: 36090
2008-09-19 05:22:43 +00:00