The cause for below 5.0 Array performance issue seems to be a change in
Array extension policy between 4.2 and 5.0:
4.2 extends a full Array by adding another 50% to its size
5.0 extends a full Array by the smaller of: 50% of its size, and 100

As such, to reach 2 million items, 4.2 has to extend an Array approx. 30
times, whereas 5.0 needs to extend approx. 20.000 times.

Unless there were some good reasons to set the maximum extension limit to
just 100, I'd like to propose the following compromise:
extend any full Array by +10% of its size, but always extend by at least
100.  This would mean a reasonable 90 extensions for an array to reach 2
million items, but still make pretty good use of the available memory:
except for very small Arrays, an Array would always be at least 90% full.

What do you think?



---------- Forwarded message ----------
From: Erich <erich...@users.sf.net>
Date: Mon, Mar 20, 2017 at 6:38 PM
Subject: [oorexx:bugs] #1433 Array~append Performance
To: Ticket 1433 <1...@bugs.oorexx.p.re.sf.net>

** [bugs:#1433] Array~append Performance**

**Status:** open
**Group:** 5.0.0
**Created:** Mon Mar 20, 2017 05:38 PM UTC by Erich

The current 5.0 build shows an almost 150-fold performance decrease vs. 4.2
for the following code snippet.
5.0 takes 114 sec, while 4.2 takes 0.77 sec

While specifying `.Array~new(2000000)` instead of `.Array~new` will bring
performance back to expected (5.0 goes down to 0.6 sec; 4.2 slightly
decreases to 0.7 sec), this should really be investigated.

~~~~
a = .Array~new
call time "r"
do i = 1 to 2000000
  a~append(i)
end
say a~size time("e")
~~~~
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to