Re: [Chicken-users] read-u8vector: types.db inconsistent with documentation

2015-06-25 Thread Christian Kellermann
Evan Hanson ev...@foldling.org writes:

 Thanks Andy, this warning is indeed incorrect. A patch has been
 posted to fix it.

Which has been pushed. Thank you gentlemen!

-- 
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread Dan Leslie

SBCL is Public Domain/MIT/BSD, depending on the component. GMP is dual
licensed as LGPL3 and GPL2.

The licensing issues would impact those who distribute binaries built
with SBCL, but only if they are statically linked to GMP.

-Dan

Stephen Eilert spedr...@gmail.com writes:

 On Thu, Jun 25, 2015 at 4:50 PM, Peter Bex pe...@more-magic.net wrote:

 On Thu, Jun 25, 2015 at 11:39:50AM -0700, Martin DeMello wrote:
  Post to /r/scheme about chicken's bignum performance. (Not my post,
  just figured it could use some eyeballs.)
 
 
 http://www.reddit.com/r/scheme/comments/3b1ujw/performance_of_chicken_scheme_numbers_bignums/

 Hello Martin,

 Thanks for posting this.  We had already been discussing it earlier
 today in #chicken.  I had another look at the code but I can't really
 find any obvious inefficiencies.  It is indeed a bit faster with
 CHICKEN 5, but not by much.

 Of course, Guile is cheating by using GMP.  If I compare it to another
 Scheme which has its own bignum implementation like Gauche, we perform
 about the same.  It's interesting that sbcl is doing so well.  Maybe I'm
 overlooking something seemingly minor but important?

 Cheers,
 Peter



 Not sure about the status of this particular GSOC, but SBCL could also be
 cheating.

 http://www.sbcl.org/gsoc2013/ideas/#sec-1.2

 Now, I thought GMP were GPL'd and SBCL not, so I'm unsure about the legal
 implications, if it does bundle GMP now.


 — Stephen
 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

-- 
-Dan Leslie

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread Peter Bex
On Thu, Jun 25, 2015 at 11:39:50AM -0700, Martin DeMello wrote:
 Post to /r/scheme about chicken's bignum performance. (Not my post,
 just figured it could use some eyeballs.)
 
 http://www.reddit.com/r/scheme/comments/3b1ujw/performance_of_chicken_scheme_numbers_bignums/

Hello Martin,

Thanks for posting this.  We had already been discussing it earlier
today in #chicken.  I had another look at the code but I can't really
find any obvious inefficiencies.  It is indeed a bit faster with
CHICKEN 5, but not by much.

Of course, Guile is cheating by using GMP.  If I compare it to another
Scheme which has its own bignum implementation like Gauche, we perform
about the same.  It's interesting that sbcl is doing so well.  Maybe I'm
overlooking something seemingly minor but important?

Cheers,
Peter


signature.asc
Description: Digital signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread cowan
Peter Bex scripsit:

 Thanks for posting this.  We had already been discussing it earlier
 today in #chicken.  I had another look at the code but I can't really
 find any obvious inefficiencies.  It is indeed a bit faster with
 CHICKEN 5, but not by much.

Potential confounders are the I/O and the call to format.  When I
get a chance, I'll try running the core of the code on the various
implementations on my Scheme machine (which I only have access to
nights and weekends now, thanks to $EMPLOYER's paranoia).

-- 
John Cowan  http://www.ccil.org/~cowanco...@ccil.org
An observable characteristic is not necessarily a functional requirement.
--John Hudson



___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread Peter Bex
On Thu, Jun 25, 2015 at 10:26:53PM +0200, Peter Bex wrote:
 On Thu, Jun 25, 2015 at 05:04:17PM -0300, Stephen Eilert wrote:
  Not sure about the status of this particular GSOC, but SBCL could also be
  cheating.
  
  http://www.sbcl.org/gsoc2013/ideas/#sec-1.2
  
  Now, I thought GMP were GPL'd and SBCL not, so I'm unsure about the legal
  implications, if it does bundle GMP now.
 
 Thanks for posting that; I hadn't looked at the sbcl implementation
 of the pi-digits benchmark, but indeed that page says Pi digits on
 the benchmarks game is currently a bunch of calls to GMP.  This would
 *really* be cheating in my opinion, as it's not testing the language
 implementation but using nonstandard extensions that replace stuff
 that's already part of the core.
 
 I had just assumed it would be using the sbcl native implementation
 (which indeed is pretty damn good and almost 100% pure Lisp code).

In fact, there are two implementations, one of which uses native
operations.  It is still faster than CHICKEN and very close to Guile/GMP:

http://benchmarksgame.alioth.debian.org/u32/program.php?test=pidigitslang=sbclid=2#log

It does use some type annotations, though.  Adding some to the
CHICKEN version makes it go a tiny bit faster, but not by much.

Cheers,
Peter


signature.asc
Description: Digital signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread Stephen Eilert
On Thu, Jun 25, 2015 at 4:50 PM, Peter Bex pe...@more-magic.net wrote:

 On Thu, Jun 25, 2015 at 11:39:50AM -0700, Martin DeMello wrote:
  Post to /r/scheme about chicken's bignum performance. (Not my post,
  just figured it could use some eyeballs.)
 
 
 http://www.reddit.com/r/scheme/comments/3b1ujw/performance_of_chicken_scheme_numbers_bignums/

 Hello Martin,

 Thanks for posting this.  We had already been discussing it earlier
 today in #chicken.  I had another look at the code but I can't really
 find any obvious inefficiencies.  It is indeed a bit faster with
 CHICKEN 5, but not by much.

 Of course, Guile is cheating by using GMP.  If I compare it to another
 Scheme which has its own bignum implementation like Gauche, we perform
 about the same.  It's interesting that sbcl is doing so well.  Maybe I'm
 overlooking something seemingly minor but important?

 Cheers,
 Peter



Not sure about the status of this particular GSOC, but SBCL could also be
cheating.

http://www.sbcl.org/gsoc2013/ideas/#sec-1.2

Now, I thought GMP were GPL'd and SBCL not, so I'm unsure about the legal
implications, if it does bundle GMP now.


— Stephen
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread Peter Bex
On Thu, Jun 25, 2015 at 03:59:59PM -0400, co...@ccil.org wrote:
 Peter Bex scripsit:
 
  Thanks for posting this.  We had already been discussing it earlier
  today in #chicken.  I had another look at the code but I can't really
  find any obvious inefficiencies.  It is indeed a bit faster with
  CHICKEN 5, but not by much.
 
 Potential confounders are the I/O and the call to format.  When I
 get a chance, I'll try running the core of the code on the various
 implementations on my Scheme machine (which I only have access to
 nights and weekends now, thanks to $EMPLOYER's paranoia).

I already removed the use of the format egg (the code contains a
commented-out version that relies only on display), and even
completely disable the println call.  It's hard to be sure, but it
*looks* like the majority of the time is being spent in the division
procedures.

Seeing how it fares on other Schemes would be interesting though!

Cheers,
Peter


signature.asc
Description: Digital signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread Peter Bex
On Thu, Jun 25, 2015 at 05:04:17PM -0300, Stephen Eilert wrote:
 Not sure about the status of this particular GSOC, but SBCL could also be
 cheating.
 
 http://www.sbcl.org/gsoc2013/ideas/#sec-1.2
 
 Now, I thought GMP were GPL'd and SBCL not, so I'm unsure about the legal
 implications, if it does bundle GMP now.

Thanks for posting that; I hadn't looked at the sbcl implementation
of the pi-digits benchmark, but indeed that page says Pi digits on
the benchmarks game is currently a bunch of calls to GMP.  This would
*really* be cheating in my opinion, as it's not testing the language
implementation but using nonstandard extensions that replace stuff
that's already part of the core.

I had just assumed it would be using the sbcl native implementation
(which indeed is pretty damn good and almost 100% pure Lisp code).

Cheers,
Peter


signature.asc
Description: Digital signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread cowan
Peter Bex scripsit:

 Of course, Guile is cheating by using GMP.  If I compare it to another
 Scheme which has its own bignum implementation like Gauche, we perform
 about the same.  It's interesting that sbcl is doing so well.  Maybe I'm
 overlooking something seemingly minor but important?

Here's a remark from the SBLC ideas page that may be helpful:

Integer division is notorious for being slow. However, it is also known
that the divisor is constant in the vast majority of cases, and serious
compilers exploit that fact to simplify divisions into sequences of simpler
multiplications, shifts, and additions. SBCL implements such a
simplification only for truncated division of unsigned machine words. Floor
and ceiling are less commonly supported natively in programming languages,
and there is a dearth of literature describing how to simplify them.
However, it is possible to do so, for both signed and unsigned machine
integers. It is also possible to specialise the routines for tagged
arithmetic. A complete execution of this project would include the
development of simplification routines for signed and unsigned truncate,
floor and ceiling divisions by integer constants. Some of the
simplifications, particularly those concerning tagged integers, will be
widely applicable and likely novel.


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] performance of bignums

2015-06-25 Thread Stephen Eilert
On Thu, Jun 25, 2015 at 5:53 PM, Peter Bex pe...@more-magic.net wrote:

 On Thu, Jun 25, 2015 at 10:26:53PM +0200, Peter Bex wrote:
  On Thu, Jun 25, 2015 at 05:04:17PM -0300, Stephen Eilert wrote:
   Not sure about the status of this particular GSOC, but SBCL could also
 be
   cheating.
  
   http://www.sbcl.org/gsoc2013/ideas/#sec-1.2
  
   Now, I thought GMP were GPL'd and SBCL not, so I'm unsure about the
 legal
   implications, if it does bundle GMP now.
 
  Thanks for posting that; I hadn't looked at the sbcl implementation
  of the pi-digits benchmark, but indeed that page says Pi digits on
  the benchmarks game is currently a bunch of calls to GMP.  This would
  *really* be cheating in my opinion, as it's not testing the language
  implementation but using nonstandard extensions that replace stuff
  that's already part of the core.
 
  I had just assumed it would be using the sbcl native implementation
  (which indeed is pretty damn good and almost 100% pure Lisp code).

 In fact, there are two implementations, one of which uses native
 operations.  It is still faster than CHICKEN and very close to Guile/GMP:


 http://benchmarksgame.alioth.debian.org/u32/program.php?test=pidigitslang=sbclid=2#log

 It does use some type annotations, though.  Adding some to the
 CHICKEN version makes it go a tiny bit faster, but not by much.

 Cheers,
 Peter


That compilation output is amazing!

; note: forced to do GENERIC-* (cost 30)
;   unable to do inline fixnum arithmetic (cost 4) because:
;   The first argument is a INTEGER, not a FIXNUM.
;   The result is a (VALUES INTEGER OPTIONAL), not a (VALUES
FIXNUM REST T).
;   unable to do inline (signed-byte 32) arithmetic (cost 5) because:
;   The first argument is a INTEGER, not a (SIGNED-BYTE 32).
;   The result is a (VALUES INTEGER OPTIONAL), not a (VALUES
;
(SIGNED-BYTE 32) REST
;  T).


From the benchmark page (
http://benchmarksgame.alioth.debian.org/u32/performance.php?test=pidigits#about
):

In addition to language specific multiprecision arithmetic, we will accept
programs that use GMP http://gmplib.org/.

So, the cheating is official. Let's cheat too!
*I fail to see the point though. If it's a programming language shootout,
does it make sense to offload the meat of the processing to GMP?* *Do they
intend to measure the FFI performance?*


— Stephen
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] performance of bignums

2015-06-25 Thread Martin DeMello
Post to /r/scheme about chicken's bignum performance. (Not my post,
just figured it could use some eyeballs.)

http://www.reddit.com/r/scheme/comments/3b1ujw/performance_of_chicken_scheme_numbers_bignums/

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] callbacks returning twice

2015-06-25 Thread Jörg F. Wittenberger
Hi all,

for a couple of days I've been looking into iup for chicken.  This is
close to the best thing since sliced bread in a way.

Except that it crashes all the time.  callback returned twice

So what's the recipe to hit that problem?

(The code is fairly trivial; I'm just exploring.  Actually I was about
to ask what I'm doing there in the first module is so basic textbook
stuff, which egg do I actually want to use instead of mimicking it
here? - It registers some callbacks around data to propagate updates to
the gui elements.)

Thanks for any suggestions.

/Jörg

(I attach my code here for reference.  Just in case.  It really does not
too much; the second and third tab are only useful in connection with a
server, just the first one usable out of the box.  Not much different to
csi, just with a gui.)
(use iup)
(use srfi-18)
(use tcp)
(use irregex)

(define xoid
  (let ((l '((dienste . A53ef7bc7b867017a9b97f36ad7020240)))
	(c 'A0001))
(lambda x
  (if (pair? x)
	  (let ((h (assoc (car x) l)))
	(if (pair? h) (set! c (cdr h)
  c)))

(module
 iubserver
 (iubserver-verbose
  make-observable connect! disconnect! value value-set! iup-connected)
 (import scheme chicken iup-base srfi-1 (only extras format) (only data-structures identity))
 ;; The first part is rather questionable if not outright stupid.
 (define-values (next-iubserver-handle new-iubserver-handle)
   (let ((n 0))
 (values
  (lambda () n)
  (lambda (proc) (let ((r (proc n))) (set! n (add1 n)) r)
 (define *observers* '())
 (define (*observer-add! k v) (set! *observers* (alist-cons k v *observers*)))
 (define (*observer-delete! k)
   (and-let*
((e (assoc k *observers*)))
(set! *observers* (delete! e *observers*))
(cdr e)))
 
 (define-record iobserver receiver)

 (define (finalize-observer x)
   (and-let* ((f (*observer-delete! (iobserver-receiver x (f x)))
 
 (define (make-observer receiver . key+finalizer)
   (let ((x (make-iobserver receiver))
	 (key (if (pair? key+finalizer) (car key+finalizer) receiver))
	 (final (cond ((and-let* (((pair? key+finalizer))
  (finalizer? (car key+finalizer))
  ((pair? finalizer?)))
 finalizer?)
		   = car)
		  (else identity
 (*observer-add! key final)
 (set-finalizer! x finalize-observer)
 x))
 
 (define-record iobservable name value converter receivers)
 (define-record-printer (iobservable x out)
   (format out iobservable ~a ~a (iobservable-name x) (iobservable-receivers x)))

 (define (make-observable name initial . proc)
   (make-iobservable name initial (and (pair? proc) (car proc)) '()))
 
 (define (connect! source receiver)
   (let ((receiver (if (iobserver? receiver) (iobserver-receiver receiver) receiver)))
 (iobservable-receivers-set! source (cons receiver (iobservable-receivers source)))
 (receiver receiver (iobservable-value source)))
   source)

 (define (disconnect! source receiver)
   (let ((receiver (if (iobserver? receiver) (iobserver-receiver receiver) receiver)))
 (iobservable-receivers-set! source (delete receiver (iobservable-receivers source
   source)

 (define (value record) (iobservable-value record))

 (define iubserver-verbose #f)
 
 (define (value-set! record new)
   (let* ((old (iobservable-value record))
	  (new (if (iobservable-converter record) ((iobservable-converter record) old new)
		   (if (equal? old new) old new
 (if (eq? old new)
	 (begin
	   (if iubserver-verbose (format (current-error-port) Warning: ignored update on ~a\n record))
	   #f)
	 (let ((new (force new)))
	   (iobservable-value-set! record new)
	   (for-each
	(lambda (receiver) (receiver receiver new))
	(iobservable-receivers record))
	   old

(define (finalize-iobserver handle)
  (and-let* ((nm (handle-name handle))
	 (f (*observer-delete! nm)))
	(f handle)))

(define (cons-iobserver-receiver nm receiver)
  (lambda (self v)
(let ((handle (handle-ref nm)))
  (receiver self handle v)
  (refresh handle

(define (cons-iobserver-finalizer nm source receiver)
  (lambda (x) (disconnect! source receiver) (destroy! x)))

 (define (iup-connected source receiver constructor . args)
   (let ((nm (new-iubserver-handle (lambda (x) (format ~a#42.iobserver x
	 (handle (apply constructor args)))
 (handle-name-set! handle nm)
 (connect! source (cons-iobserver-receiver nm receiver))
 (*observer-add! nm (cons-iobserver-finalizer nm source receiver))
 (set-finalizer! handle finalize-iobserver)
 handle))

 
 ) (import iubserver)

(begin
  ;; Set timer to 25Hz for smoot updates.  Beware: I have not yet
  ;; found a way do unblock iup by i/o.  Don't run time critical code
  ;; in the same pthread as iup.  Since iup is currently fixed to the
  ;; chicken thread, this means time critical code should go into it's
  ;; own executable.
  (attribute-set! thread-watchdog 'run #f)
  (attribute-set! thread-watchdog 'time 50)
  (attribute-set! 

Re: [Chicken-users] callbacks returning twice

2015-06-25 Thread Matt Gushee
On Thu, Jun 25, 2015 at 6:41 PM, Matt Welland mattrwell...@gmail.com
wrote:


 I've been using IUP for quite a while and I don't recall seeing the
 message callback returned twice.


That particular error comes from runtime.c in the Chicken core - and the
procedure that raises it is not directly called either from iup or Jörg's
code ... so no obvious indication of what is triggering it.

--
Matt Gushee
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] callbacks returning twice

2015-06-25 Thread Matt Gushee
Hi, Jörg--

I don't know if I have any answers, but having struggled with a few IUP
issues, I thought I'd take a look. However, I tried to compile your code
and ...

 Warning: reference to possibly unbound identifier `gridbox'

Yes, indeed it is unbound. There is no reference to 'gridbox' in the IUP
egg (v1.6.0) source code. What version of the egg are you using - or did
you add gridbox support yourself?

--
Matt Gushee
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] callbacks returning twice

2015-06-25 Thread Matt Welland
Hi Jörg,

I've been using IUP for quite a while and I don't recall seeing the message
callback returned twice. Perhaps it is something with the newer version
of IUP you appear to be using. I would be interested to know if it works
with chicken-iup? My virtualbox install seems to have broken in some recent
upgrade and I have no access to Windows to try it myself. I can't run your
code on Linux as my install of iup is probably too old:

 csc iuprep.scm

Warning: reference to possibly unbound identifier `gridbox'

Error: module unresolved: ask-repl

Error: shell command terminated with non-zero exit status 256:
'/mfs/pkgs/chicken/4.9.0.1_for_14.04/bin/chicken' 'iuprep.scm' -output-file
'iuprep.c'

I was curious to see what I could learn from your code but unfortunately it
is appears beyond my current skill level and is mostly incomprehensible to
me. I'll keep trying :)

Matt
-=-

BTW: chicken-iup is at www.kiatoa.com/fossils/chicken-iup

On Thu, Jun 25, 2015 at 2:54 PM, Jörg F. Wittenberger 
joerg.wittenber...@softeyes.net wrote:

 Hi all,

 for a couple of days I've been looking into iup for chicken.  This is
 close to the best thing since sliced bread in a way.

 Except that it crashes all the time.  callback returned twice

 So what's the recipe to hit that problem?

 (The code is fairly trivial; I'm just exploring.  Actually I was about
 to ask what I'm doing there in the first module is so basic textbook
 stuff, which egg do I actually want to use instead of mimicking it
 here? - It registers some callbacks around data to propagate updates to
 the gui elements.)

 Thanks for any suggestions.

 /Jörg

 (I attach my code here for reference.  Just in case.  It really does not
 too much; the second and third tab are only useful in connection with a
 server, just the first one usable out of the box.  Not much different to
 csi, just with a gui.)

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] read-u8vector: types.db inconsistent with documentation

2015-06-25 Thread Andy Bennett

Hi,


Thanks Andy, this warning is indeed incorrect. A patch has been
posted to fix it.


Thanks! :-)


--
andy...@ashurst.eu.org
http://www.ashurst.eu.org/
http://www.gonumber.com/andyjpb
0x7EBA75FF

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users