Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

php is definitely better these days (i used to use it early in my career), but unless you're already knee-deep in php, i can't think of a web project where php/laravel would generally be a better choice than ruby/rails. alas, ruby has become passé too, in favor of javascript, a decidedly unrefined language.

javascript has too many hidden ways to shoot yourself in the foot, and just hasn't evolved for developer happiness the way php and ruby have.



As a Laravel dev who almost went down the Rails path, I’m curious: what advantages do you think Rails has over Laravel at this point?


honestly i haven't looked at laravel recently enough to remember the specifics (although others here seem to have), but 2 general stengths are (1) ruby is more consistent, intuitive and fun vs. php, and (2) rails has reasonable defaults, easy configurability on top of that, and a nice ecosystem of both built-in and community-built widgets. it's so fast to get up and running with rails.

but i'd pick php over js any day! (probably even over python/django, unless data mining is a core concern)


Definitely not performance [1]. Maybe aesthetics?

[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...


Which part do you see that is not performance in that benchmark which shown the average time? I have tried benchmark on my own and PHP took longer than RubyJIT.


Every benchmark on that page is faster for PHP


"Every benchmark on that page is faster for PHP"

Let me advice you to benchmark it "accuracy" on your machine setup, don't rely what is on that page.

Make sure the error with --jit-verbose=1 which will show whether it uses MJIT correctly.

ruby --jit-verbose=1

- N-Body single core

Ruby 2.6.3 6:22.00s

RubyJIT 2.6.3 3:58.18s

PHP 7.3.xx 4:10.90s


> will show whether it uses MJIT correctly

    …
    JIT success (511.7ms): [email protected]:14 -> /tmp/_ruby_mjit_p5804u105.c
    JIT success (397.5ms): block in [email protected]:68 -> /tmp/_ruby_mjit_p5804u106.c
    JIT success (607.0ms): block in [email protected]:50 -> /tmp/_ruby_mjit_p5804u108.c
    JIT compaction (53.6ms): Compacted 111 methods -> /tmp/_ruby_mjit_p5804u111.so
    Successful MJIT finish

    real 6m4.201s
    user 6m42.813s
    sys 0m4.041s



    $ time /opt/src/php-7.3.11/bin/php -n  nbody.php 50000000
    -0.169075164
    -0.169059907

    real 5m24.915s
    user 5m24.808s
    sys 0m0.020


As for mine, Ruby slightly faster 4:05s - 4:09s which is close to PHP in timing.

ruby 2.7.0dev (2019-11-23T07:06:30Z master b563439274) [x86_64-darwin18]

gtime -v /usr/local/bin/ruby --jit -W0 nbody.rb 50000000 -0.169075164 -0.169059907

Command being timed: "/usr/local/bin/ruby --jit -W0 nbody.rb 50000000"

User time (seconds): 249.30 System time (seconds): 0.58 Percent of CPU this job got: 100% Elapsed (wall clock) time (h:mm:ss or m:ss): 4:08.97

---

PHP 7.3.11 (cli) (built: Oct 24 2019 11:29:52) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.11, Copyright (c) 1999-2018, by Zend Technologies

gtime -v php -n nbody.php 50000000

-0.169075164 -0.169059907

Command being timed: "php -n nbody.php 50000000" User time (seconds): 248.02 System time (seconds): 0.49 Percent of CPU this job got: 99% Elapsed (wall clock) time (h:mm:ss or m:ss): 4:09.82


Polish and refinement. Ruby's expressiveness and clean design make possible a level of elegance in Rails that I haven't seen in any other web framework. Ruby lends itself to DSLs much more than most other languages, Clojure excepted, and its meta-programming makes possible a number of shortcuts which help you to get a project up and running in record time. Add to that the magnitude of commits to the Rails project over its 14-year history and you have an ideal tool for SME web projects.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: