patchAVR C Runtime Library - Patches: patch #3729, Printf for integers speed up

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #3729: Printf for integers speed up

Submitter:  None
Submitted:  Tue 08 Feb 2005 11:38:04 PM UTC
   
 
Category:  None Priority:  9 - Immediate
Status:  Done Privacy:  Public
Assigned to:  dmix Originator Email:  -email is unavailable-
Open/Closed:  Closed

Jump to the original submission

Sun 29 Jul 2012 03:37:54 PM UTC, comment #10: 

Patch is applied at rev. 2298.
Thanks to Georg-Johann Lay!

Dmitry Xmelkov <dmix>
Group administrator
Sun 22 Jul 2012 07:52:13 AM UTC, comment #9: 

Similarly above the itoa() and utoa() are rewriten.
The attach contains edited variant of this functions with
micro optimization: the bit counter is initialized only once.
The radix is checked at compile time. Nevertheless, the
full variants of utoa() and itoa() functions are leaved in
library for compatibility (if any uses it from asm).

If no objections, I will remove radix check from ltoa/ultoa
and commit both.


(file #26244)

Dmitry Xmelkov <dmix>
Group administrator
Sun 15 Jul 2012 09:46:27 AM UTC, comment #8: 

Georg-Johann Lay rewrite ultoa() function by inlining
division 32:8. In result the total size and speed are
improved. See the discussion on 'avr-gcc-list'.

In contrast to dmix's fast function the Georg-Johann Lay's
variant is work with all possible bases.

Changes are (in comparison to original):
1. ltoa() calls ultoa() (extra entry).
2. Small optimization: initialization of bits counter is
excluded (32*8=256).
3. This is debatable: run time radix check. The cost is
only 5 words, but there is no risk of overhead in case
variable radix. Thougths?


(file #26206)

Dmitry Xmelkov <dmix>
Group administrator
Thu 12 May 2011 10:08:57 PM UTC, comment #7: 

Dmitry,

Any progress on these patches?

Eric Weddington <arcanum>
Group administrator
Tue 08 Jun 2010 12:08:37 PM UTC, comment #6: 

These are Dmitry's own patches.

Joerg Wunsch <joerg_wunsch>
Group administrator
Sat 27 Oct 2007 02:02:35 AM UTC, comment #5: 

Now this patch is partially applied: the vfprintf() function
(CVS main) uses the __ultoa_invert() engine to convert an
integers without division operation.  The speed is considerable
up.

Dmitry Xmelkov <dmix>
Group administrator
Fri 25 Feb 2005 05:30:41 AM UTC, comment #4: 

All functions are present.

Anonymous
Sat 12 Feb 2005 01:26:27 AM UTC, comment #3: 

`invert-tst.sh' (test script) is changed for convenient running by parts.

Anonymous
Thu 10 Feb 2005 10:53:45 PM UTC, comment #2: 

itoa_fast-20050211:  cosmetic changes, fixed bug in test script
(empty file list in `simul'), added new script for full testing.

Full testing is difficult: run of `invert-tst.sh' (65536 * 65536 portions)
is requed above 1 month on Athlon 0.85 GHz.

Anonymous
Wed 09 Feb 2005 11:03:58 PM UTC, comment #1: 

Final (I hope) version of `ultoa_invert.S'.

Comparison old (avr-libc 1.2.1) and new `printf':
(With: avr-gcc 3.3.4, -Os -frename-registers, PRINTF_STD)

sprintf(s,"%d",12345), clocks:
    at91s8515:  7096 --> 1717
    atmega8:    6945 --> 1633

sprintf(s,"%x",0x1234), clocks:
    at91s8515:  5747 --> 1059
    atmega8:    5622 --> 1006

main() { sprintf(s,"%d",12345); return 0; }
size, words:
    at90s8515:  1048 --> 1026
    atmega8:    961 --> 939

vfprintf.c, stack usage, bytes:
    36 --> 33

Deep testing is needed for decimals.

Anonymous
Tue 08 Feb 2005 11:38:04 PM UTC, original submission:  

Now performance of function `sprintf(s,"%d",12345)' takes more than
7000 clocks. The reason -- division (long) which is required for a
conversion of each digit. I have tried to replace division into more
simple operations. In result this time became 1800 clocks. For 'hex' or
'octal' -- 1000 clocks. The general size has a little decreased.

Detail testing is needed now (9 feb 2005). And it is possible bigger
speed up.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #26244:  itoa-20120722.tar.gz added by dmix (4KiB - application/x-gzip - itoa/utoa new variant and tests)
file #26206:  ltoa-2012.tar.gz added by dmix (4KiB - application/x-gzip - Georg-Johann Lay's new variant (edited by dmix) and tests)
file #5430:  itoa-20051120.tar.gz added by joerg_wunsch (35KiB - application/gzip - Dmitry's updated patch file, he's got troubles sending attachments)
file #8463:  itoa_fast-20050225.tar.gz added by None (25KiB - application/x-tgz - Patch sources and tests.)
file #8400:  invert-tst.sh added by None (2KiB - application/x-shellscript - Test script for `__ultoa_invert' function by parts.)
file #8395:  itoa_fast-20050211.tar.gz added by None (14KiB - application/x-tgz - Tarball with sources and test suite.)
file #8394:  itoa_fast-20050210.tar.gz added by None (14KiB - application/x-tgz - Tarball with sources and test suite.)
file #8389:  itoa_fast-20050209.tar.gz added by None (14KiB - application/x-tgz - Tarball with sources and test suite. Preliminary.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by dmix (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-07-29 dmix StatusIn Progress Done
        Open/ClosedOpen Closed
    2012-07-22 dmix Attached File- Added itoa-20120722.tar.gz, #26244
    2012-07-15 dmix Attached File- Added ltoa-2012.tar.gz, #26206
    2010-06-08 joerg_wunsch Assigned tojoerg_wunsch dmix
    2007-10-27 dmix StatusNone In Progress
    2006-09-13 arcanum Priority5 - Normal 9 - Immediate
    2005-11-20 joerg_wunsch Attached File- Added itoa-20051120.tar.gz, #5496
    2005-11-18 joerg_wunsch Assigned toNone joerg_wunsch
    2005-02-25 None Attached File- Added itoa_fast-20050225.tar.gz, #4235
    2005-02-12 None Attached File- Added invert-tst.sh, #4172
    2005-02-10 None Attached File- Added itoa_fast-20050211.tar.gz, #4167
    2005-02-09 None Attached File- Added itoa_fast-20050210.tar.gz, #4166
    2005-02-08 None Attached File- Added itoa_fast-20050209.tar.gz, #4164

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code