News for hackers. Stuff that matters.
Re:ChaiScript – Easy to Use Scripting for C++ by earenndil on Thursday July 25, 2019 @08:08PM (#20531133)
By the by, why does your python example import a bunch of things, but the php code imports nothing? That would negate the entire purpose of the experiment, no...
Re:ChaiScript – Easy to Use Scripting for C++ by mehrdadn on Thursday July 25, 2019 @08:27PM (#20531228)
Because, there wasn't anything to import?! preg_match(), getopt(), system(), etc. are already available... if anything, you should be asking why I'm unfairly penalizing PHP by comparing it against a no-import Python!

And I did give you an example of Python that doesn't import anything, and as you can see (and could have easily tested yourself) it was still a lot slower...

Re:ChaiScript – Easy to Use Scripting for C++ by earenndil on Friday July 26, 2019 @01:17AM (#20532534)
Python not importing anything is the same speed as php not importing anything on my system. Oh, and--incidentally, javascript is 20% faster than php and python both, and afaik you don't have to import libraries there either.
Re:ChaiScript – Easy to Use Scripting for C++ by mehrdadn on Friday July 26, 2019 @01:51AM (#20532675)
Yes, so that means Python is slower to start on your system too. Not sure what you mean by "Javascript"... what program are you running?
Re:ChaiScript – Easy to Use Scripting for C++ by earenndil on Friday July 26, 2019 @03:36AM (#20533050)
Javascriptcore; jsc. It's part of webkit (comes from the webkit2gtk package on my system).
Re:ChaiScript – Easy to Use Scripting for C++ by mehrdadn on Friday July 26, 2019 @04:18AM (#20533200)
Oh I see. Cool.

Now compare with Lua:

  $ python3 -c "import sys, timeit; n = 10; print('%.2f ms/spawn' % (1000 * timeit.timeit('subprocess.call([%r, %r], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL)' % ('lua', '-'), 'import subprocess', number=n) / n))"
  1.09 ms/spawn
NewLisp:

  $ python3 -c "import sys, timeit; n = 10; print('%.2f ms/spawn' % (1000 * timeit.timeit('subprocess.call([%r, %r], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL)' % ('newlisp', '-'), 'import subprocess', number=n) / n))"
  1.25 ms/spawn