Re: [E-devel] [PATCH] Some small speedup for Edje

2008-04-05 Thread Cedric BAIL
On Thu, Apr 3, 2008 at 10:15 PM, The Rasterman Carsten Haitzler
[EMAIL PROTECTED] wrote:
 On Thu, 03 Apr 2008 21:25:05 +0200 Kim Woelders [EMAIL PROTECTED] babbled:
   Cedric BAIL wrote:
  So here are some patch that should not break edje too much.
   
0001 and 0002: Replace call to snprintf by using memcpy or some kind of
itoa.
  
   Is this really worth while? Possibly a small speedup at the cost of
   considerably more and considerably uglier code?

I could perhaps clean a little bit the code, but using snprintf when
only memcpy is really required slow thing down (around 5% of my time
lost in snprintf, with modification 0.1% in memcpy and 1% in
snprintf). It's definitively a win. A minimal one, but a win.

  i've reverted them anyway.. b0rks. :(

I believe only 0004 should be risky, the other shouldn't be risky. But
as it break illumine. I should try it. Do you have a tarball, an url
or something for this stuff ?

-- 
Cedric BAIL

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [PATCH] Some small speedup for Edje

2008-04-05 Thread Vincent Torri


On Fri, 4 Apr 2008, Cedric BAIL wrote:

 I believe only 0004 should be risky, the other shouldn't be risky. But
 as it break illumine. I should try it. Do you have a tarball, an url
 or something for this stuff ?

http://illume.projects.openmoko.org/

Vincent

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] [PATCH] Some small speedup for Edje

2008-04-03 Thread Cedric BAIL
Hi,

  So here are some patch that should not break edje too much.

0001 and 0002: Replace call to snprintf by using memcpy or some kind of itoa.
0003: edje_match can work without the need to call memset.
0004: When edje hide an object, their is no need to move/resize it and
mark it as changed (because when it will be shown again, we will move
it any way). This should delay the update of swallowed object and
could have some border effect I didn't know about. I didn't find any
issue with enlightenment nor the app I am using, but it will be better
if some more people could test this patch.

Have fun,
  Cedric
-- 
Cedric BAIL
From 08d8bdad2c2752d076e4efe9b168df43068bc885 Mon Sep 17 00:00:00 2001
From: Cedric BAIL [EMAIL PROTECTED]
Date: Thu, 3 Apr 2008 17:51:38 +0200
Subject: [PATCH] Replace snprintf by faster call to memcpy.

---
 src/lib/edje_load.c |   20 +++-
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/lib/edje_load.c b/src/lib/edje_load.c
index cc659d9..0117e14 100644
--- a/src/lib/edje_load.c
+++ b/src/lib/edje_load.c
@@ -1002,14 +1002,24 @@ _edje_collection_free_prog_cache_matches_free_cb(const Evas_Hash *hash, const ch
 static void
 _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source)
 {
-   Evas_Object *parent;
-   Edje *ed;
-   char new_src[4096]; /* XXX is this max reasonable? */
+   Evas_Object	*parent;
+   Edje		*ed;
+   char		 new_src[4096]; /* XXX is this max reasonable? */
+   int		 length_parent;
+   int		 length_source;
 
parent = data;
ed = _edje_fetch(obj);
if (!ed) return;
-   snprintf(new_src, sizeof(new_src), %s%c%s, ed-parent,
-EDJE_PART_PATH_SEPARATOR, source);
+   /* Replace snprint(%s%c%s) == memcpy + *new_src + memcat */
+   length_parent = strlen(ed-parent);
+   length_source = strlen(source);
+   if (length_source + length_parent + 2  sizeof(new_src))
+ return ;
+
+   memcpy(new_src, ed-parent, length_parent);
+   new_src[length_parent] = EDJE_PART_PATH_SEPARATOR;
+   memcpy(new_src + length_parent + 1, source, length_source + 1);
+
edje_object_signal_emit(parent, signal, new_src);
 }
-- 
1.5.4.GIT

From 32fc1af53975983829504c39f340a9d507506001 Mon Sep 17 00:00:00 2001
From: Cedric BAIL [EMAIL PROTECTED]
Date: Thu, 3 Apr 2008 17:54:12 +0200
Subject: [PATCH] Replace snprintf by faster memcpy and own itoa.

---
 src/lib/edje_calc.c |   61 ++-
 1 files changed, 60 insertions(+), 1 deletions(-)

diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c
index 8b390bf..972f89b 100644
--- a/src/lib/edje_calc.c
+++ b/src/lib/edje_calc.c
@@ -1114,6 +1114,61 @@ _edje_gradient_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3,
  }
 }
 
+static int
+_edje_nitoa_rec(char *string, int len, unsigned int value)
+{
+   const char	*array = 0123456789;
+   int		 length;
+   int		 quotient;
+   int		 modulo;
+
+   if (len = 0) return 0;
+   if (value == 0) return 0;
+
+   quotient = value / 10;
+   modulo = value % 10;
+
+   length = _edje_nitoa_rec(string, len - 1, quotient);
+
+   if (length + 1  len) return length;
+
+   string[length] = array[modulo];
+
+   return length + 1;
+}
+
+static int
+_edje_nitoa(char *string, int len, int value)
+{
+   int	length;
+
+   if (len = 0) return 0;
+   if (len == 1)
+ {
+	*string = '\0';
+	return 1;
+ }
+
+   if (value  0)
+ {
+	*string = '-';
+
+	++string;
+	--len;
+ }
+
+   if (value == 0)
+ {
+	strncpy(string, 0, len);
+	return 1;
+ }
+
+   length = _edje_nitoa_rec(string, len, value);
+   string[length] = '\0';
+
+   return length;
+}
+
 static void
 _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc, double pos)
 {
@@ -1173,7 +1228,11 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
 	  }
 	else
 	  {
-	 snprintf(buf, sizeof(buf), images/%i, image_id);
+	 /* Replace snprint(images/%i) == memcpy + itoa */
+#define IMAGES images/
+	 memcpy(buf, IMAGES, strlen(IMAGES));
+	 _edje_nitoa(buf + strlen(IMAGES), sizeof(buf) - strlen(IMAGES), image_id);
+
 	 evas_object_image_file_set(ep-object, ed-file-path, buf);
 	 if (evas_object_image_load_error_get(ep-object) != EVAS_LOAD_ERROR_NONE)
 	   {
-- 
1.5.4.GIT

From 0cdace8774ee880b30b0784bcfbbed68930650f2 Mon Sep 17 00:00:00 2001
From: Cedric BAIL [EMAIL PROTECTED]
Date: Thu, 3 Apr 2008 17:55:00 +0200
Subject: [PATCH] Remove useless memset.

---
 src/lib/edje_match.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/lib/edje_match.c b/src/lib/edje_match.c
index 2240519..b398e5d 100644
--- a/src/lib/edje_match.c
+++ b/src/lib/edje_match.c
@@ -95,7 +95,7 @@ _edje_match_states_insert(Edje_States*list,
{
   const size_t i = idx * (patterns_max_length + 1) + pos;
 
-  if (list-has[i]) return;
+  if (list-size  i  list-has[i]) return;
   

Re: [E-devel] [PATCH] Some small speedup for Edje

2008-04-03 Thread Kim Woelders
Cedric BAIL wrote:
 Hi,
 
   So here are some patch that should not break edje too much.
 
 0001 and 0002: Replace call to snprintf by using memcpy or some kind of itoa.

Is this really worth while? Possibly a small speedup at the cost of 
considerably more and considerably uglier code?

/Kim

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [PATCH] Some small speedup for Edje

2008-04-03 Thread The Rasterman
On Thu, 03 Apr 2008 21:25:05 +0200 Kim Woelders [EMAIL PROTECTED] babbled:

 Cedric BAIL wrote:
  Hi,
  
So here are some patch that should not break edje too much.
  
  0001 and 0002: Replace call to snprintf by using memcpy or some kind of
  itoa.
 
 Is this really worth while? Possibly a small speedup at the cost of 
 considerably more and considerably uglier code?

i've reverted them anyway.. b0rks. :(


-- 
- Codito, ergo sum - I code, therefore I am --
The Rasterman (Carsten Haitzler)[EMAIL PROTECTED]


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel