valueDiff for arrays?
Brian Milby
brian at milby7.com
Sun Aug 5 23:24:07 EDT 2018
I can speed it up by 10% just be replacing the "add 1 to" with "put true
into". The first if would lose the ">0". A single pass went from 50s to
44s on my iMac.
On Sun, Aug 5, 2018 at 9:36 PM, Richard Gaskin via use-livecode <
use-livecode at lists.runrev.com> wrote:
> Mark Waddingham wrote:
>
> > Richard wrote:
> >>
> >> Thinking about performance, I wonder if there's anything from some of
> >> the changes that have boosted PHP 7's performance so far above its
> >> earlier versions which may be relevant for LC:
> >> https://www.reddit.com/r/PHP/comments/3q2brz/how_is_php_7_tw
> ice_as_fast/
> >
> > I'd actually be really interested in a direct speed comparison between
> > exactly equivalent operations in PHP7 and LC.
>
> Geoff Canyon and I corresponded on this back in March. I don't think
> he'll mind me sharing some of the relevant parts of his test:
>
> ------------------- from GC ----------------------------------------
>
> on mouseUp
> put the long seconds into T
> repeat with c = 1 to 10
> get get_primes(10000000)
> end repeat
> put "Found" && the number of lines in it && "primes in" && the long
> seconds - T && "seconds"
> end mouseUp
>
> function get_primes n
> if n < 2 then return empty
> if n = 2 then return 2
> put trunc(sqrt(n)) - 1 into mroot
> repeat with i = 3 to mroot step 2
> if np[i] > 0 then next repeat
> add 1 to p[i]
> repeat with j = i^2 to n step i
> add 1 to np[j]
> end repeat
> end repeat
> put 2 & cr & the keys of p into R
> sort lines of R numeric
> repeat with i = mroot + (mroot + 1) mod 2 to n - 1 step 2
> if np[i] is empty then put cr & i after R
> end repeat
> return R
> end get_primes
>
> And that takes about fifteen minutes to run on my 2013 MacBook Pro, where
> the slowest performer he's working with takes less than 30 seconds, and PHP
> 7 runs in under 7 seconds. Any ideas where I'm deviating in my
> implementation compared to his? Here's the latest version of his test that
> I found:
>
> https://blog.famzah.net/2016/09/10/cpp-vs-python-vs-php-vs-j
> ava-vs-others-performance-benchmark-2016-q3/
>
> -----------------------------------------------------------------
>
> --
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> Ambassador at FourthWorld.com http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list