Changeset 31361 in project


Ignore:
Timestamp:
09/10/14 16:44:01 (5 years ago)
Author:
sjamaan
Message:

numbers: Give up for now trying to further optimize number->string. Add benchmark for later, or maybe for a courageous person who wants to attempt making it perform satisfactorily

Location:
release/4/numbers/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/numbers/trunk/benchmarks/read-write.scm

    r31311 r31361  
    4444          (lp s (+ i 1)))))
    4545
     46(display "Writing a large bignum:\n")
     47
     48(time (let lp ((num (string->number (make-string 100000 #\9)))
     49               (i 0))
     50        (number->string num)
     51        (when (< i 100)
     52          (lp num (+ i 1)))))
     53
    4654(display "Testing fixnum ratnums:\n")
    4755
  • release/4/numbers/trunk/numbers-c.c

    r31360 r31361  
    22232223}
    22242224
     2225/* XXX TODO: This should be MUCH faster, dammit! */
    22252226static void
    22262227bignum_to_digits_3(C_word c, C_word self, C_word string)
     
    22332234         *scan = start + C_bignum_size(working_copy) - 1,
    22342235         len = C_header_size(string),
    2235          digit, large_digit, steps, i, base;
     2236         digit, steps, i, base;
    22362237  char *buf = C_c_string(string), *index = buf + len - 1;
    22372238
     
    22452246
    22462247  while (start <= scan) {
    2247     large_digit = bignum_digits_destructive_scale_down(start, scan, base);
     2248    digit = bignum_digits_destructive_scale_down(start, scan, base);
    22482249
    22492250    if (*scan == 0) scan--; /* Adjust if we exhausted the highest digit */
    22502251
    22512252    for(i = 0; i < steps; ++i) {
    2252       digit = large_digit % radix;
    2253       large_digit /= radix;
    2254       *index-- = characters[digit];
     2253      *index-- = characters[digit % radix];
     2254      digit /= radix;
    22552255    }
    22562256  }
Note: See TracChangeset for help on using the changeset viewer.