oldk1331 wrote:
> 
> Add a simple benchmark:
> 
> x := queue([])$Queue(Integer)
> for f in 0..(10^5) repeat enqueue!(0,x)
> 
> Before patch, it's 53.91 s, after it's 1.02 s.

Different benchmark using current (unpatched) version:

ff(n) == (x := queue([])$Queue(Integer); for f in 0..n repeat enqueue!(0,x); x)

ll := [ff(50) for i in 1..2000];
ll := [ff(100) for i in 1..1000];
ll := [ff(200) for i in 1..500];
ll := [ff(500) for i in 1..200];
ll := [ff(1000) for i in 1..100];
ll := [ff(2000) for i in 1..50];
ll := [ff(10000) for i in 1..10];

On my machine take 0.2, 0.2, 0.4, 0.6, 0.13, 0.20, 1.02 seconds.
So, surely there is quadratic behaviour, but it becomes visible
only when queue length is bigger than about 100.  And even
for relatively large value like 1000 it may easily be at
noise level (I suspect that 1.02 in your result is a noise
due to interpreter loop at top level).  In fastest case
we need about 440 clocks per queue element.  Optimistically
you may be able to cut half of that.  However, if you care
about speed array version is going to be faster.  OTOH
for many (probably most) applications current version is
fast enough.

To be clear: if you insist on this version and provide
code which passes tests I am going to include it.
However, IMO it is bad tradeof between effort and effect.


-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to