[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1604: fixnum arithmetic is ignored
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1604: fixnum arithmetic is ignored |
Date: |
Wed, 10 Apr 2019 08:52:59 -0000 |
#1604: fixnum arithmetic is ignored
---------------------------------+-------------------
Reporter: sjamaan | Owner:
Type: defect | Status: new
Priority: major | Milestone: 5.1
Component: compiler | Version: 5.0.0
Resolution: | Keywords:
Estimated difficulty: medium |
---------------------------------+-------------------
Description changed by sjamaan:
Old description:
> As reported by chickendan on IRC:
>
> ```
> ;; csc -O5 -strict-types -fixnum-arithmetic: 7.964s
> ;; csc -O5 -strict-types: 8.105s
> ;; csc -O5 -strict-types (and fx functions): 0.246s
> ;;; c/nim -O3 baseline: 0.211s
>
> (define (fib n)
> (if (or (= n 0) (= n 1))
> n
> (+ (fib (- n 1)) (fib (- n 2)))))
>
> (let loop ((n 0))
> (when (< n 35)
> (print "n=" n " => " (fib n))
> (loop (+ n 1))))
> ```
>
> This program should use fixnum ops when declaring fixnum arithmetic.
> Also, when wrapping `fib`'s body in an `assume`, it still compiles to
> `C_s_a_i_plus` calls rather than `C_a_i_fixnum_plus` or even just
> `C_s_a_u_i_integer_plus`.
>
> I think we should take a look before releasing 5.1, the fact `fixnum-
> arithmetic` is ignored may not be a big issue, but it is rather worrying
> that the specializations aren't used.
New description:
As reported by chickendan on IRC:
{{{
;; csc -O5 -strict-types -fixnum-arithmetic: 7.964s
;; csc -O5 -strict-types: 8.105s
;; csc -O5 -strict-types (and fx functions): 0.246s
;;; c/nim -O3 baseline: 0.211s
(define (fib n)
(if (or (= n 0) (= n 1))
n
(+ (fib (- n 1)) (fib (- n 2)))))
(let loop ((n 0))
(when (< n 35)
(print "n=" n " => " (fib n))
(loop (+ n 1))))
}}}
This program should use fixnum ops when declaring fixnum arithmetic.
Also, when wrapping `fib`'s body in an `assume`, it still compiles to
`C_s_a_i_plus` calls rather than `C_a_i_fixnum_plus` or even just
`C_s_a_u_i_integer_plus`.
I think we should take a look before releasing 5.1, the fact `fixnum-
arithmetic` is ignored may not be a big issue, but it is rather worrying
that the specializations aren't used.
--
--
Ticket URL: <https://bugs.call-cc.org/ticket/1604#comment:1>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.