valueDiff for arrays?

Richard Gaskin ambassador at fourthworld.com
Sun Aug 5 22:36:08 EDT 2018


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_twice_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-java-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




More information about the use-livecode mailing list