Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-08 Thread Mathias K.
Hello, On 05.02.2011 10:43, Øyvind Harboe wrote: What sort of CPU did you run the tests on? Which test? The target cpu/mcu or my system cpu? Let me know when the patch is ready to be committed. I suppose it could need a bit of coolof . I think its fine. Regards, Mathias

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-08 Thread Øyvind Harboe
On Tue, Feb 8, 2011 at 9:09 AM, Mathias K. kes...@freenet.de wrote: Hello, On 05.02.2011 10:43, Øyvind Harboe wrote: What sort of CPU did you run the tests on? Which test? The target cpu/mcu or my system cpu? System CPU. Let me know when the patch is ready to be committed. I suppose it

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-08 Thread simon qian
This code should be better optimized. But, shouldn't it be: sb = src_start / 8; db = dst_start / 8; sq = src_start % 8; dq = dst_start % 8; src += sb; dst += db; 2011/2/8 Øyvind Harboe oyvind.har...@zylin.com Merged. Thanks! -- Øyvind Harboe Can Zylin

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-08 Thread Øyvind Harboe
On Tue, Feb 8, 2011 at 11:29 AM, simon qian simonqian.open...@gmail.com wrote: This code should be better optimized. Patches welcome! But, shouldn't it be:     sb = src_start / 8;     db = dst_start / 8;     sq = src_start % 8;     dq = dst_start % 8;     src += sb;     dst += db; Isn't

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-08 Thread simon qian
I check the master branch, it's fixed an hour ago. 2011/2/8 Øyvind Harboe oyvind.har...@zylin.com On Tue, Feb 8, 2011 at 11:48 AM, simon qian simonqian.open...@gmail.com wrote: It's not in the branch. Here is the patch. Are you sure? I tried to apply your patch and it failed. Could

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-07 Thread Øyvind Harboe
What impact would it have to make this an inline fn? How often are unsigned src_start, unsigned, dst_start, unsigned len constants that could be dealt with through constant propagation and code elimination? -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-07 Thread Marc Pignat
Hi all! This seems a good idea, and you can even improve the copy doing someting like this (pseudo-code only): void* buf_set_buf(const void *_src, unsigned src_start, void *_dst, unsigned dst_start, unsigned len) { /* Are src and dst bit aligned? */ if ((dst_start

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-07 Thread Mathias K.
Hello, On 07.02.2011 09:09, Øyvind Harboe wrote: What impact would it have to make this an inline fn? I think there is no need to declare this big function as inline. This will only increase the code size. I see some functions in the jtag/interface.c file with a very small body that could

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-07 Thread Marc Pignat
On Monday 07 February 2011 09:09:36 Øyvind Harboe wrote: What impact would it have to make this an inline fn? ... Inlined or not, this function could be faster. Even with inlining and constant propagation, I don't think gcc is smart enough to replace buf_set_buf(_src, 0, dst, 0, 64); by

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-07 Thread Øyvind Harboe
On Mon, Feb 7, 2011 at 9:50 AM, Marc Pignat marc.pig...@hevs.ch wrote: On Monday 07 February 2011 09:09:36 Øyvind Harboe wrote: What impact would it have to make this an inline fn? ... Inlined or not, this function could be faster. Even with inlining and constant propagation, I don't

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-07 Thread Michael Schwingen
Am 02/07/2011 09:37 AM, schrieb Øyvind Harboe: On Mon, Feb 7, 2011 at 9:27 AM, Mathias K. kes...@freenet.de wrote: Hello, On 07.02.2011 09:09, Øyvind Harboe wrote: What impact would it have to make this an inline fn? I think there is no need to declare this big function as inline. This will

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-05 Thread Øyvind Harboe
What sort of CPU did you run the tests on? Let me know when the patch is ready to be committed. I suppose it could need a bit of coolof . -- Øyvind Harboe US toll free 1-866-980-3434 / International +47 51 63 25 00 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and

[Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-04 Thread Mathias K.
Hello, this patch increase the speed of the buf_set_buf function around 30%. Regards, Mathias diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index 3a16cce..e789e6f 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -133,19 +133,34 @@ void*

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-04 Thread Øyvind Harboe
On Fri, Feb 4, 2011 at 5:21 PM, Mathias K. kes...@freenet.de wrote: Hello, this patch increase the speed of the buf_set_buf function around 30%. how do you arrive at 30%? What overall impact does this have? -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-04 Thread Mathias K.
Hello, okay the patch has a little bug. I have not set the correct start pointer of the input and output buffer. Also i have checked the input of this function and in many cases a simple byte copy is possible. I have added this check now and is it possible the buffer is copied byte by byte

Re: [Openocd-development] [PATCH] buf_set_buf around 30% speed increase

2011-02-04 Thread Mathias K.
sorry, wrong file ... diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index 3a16cce..08e149a 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -133,19 +133,48 @@ void* buf_set_buf(const void *_src, unsigned src_start, { const uint8_t *src =